Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to calculate percentage easily? #5

Closed
jackywu opened this issue Mar 24, 2024 · 1 comment
Closed

how to calculate percentage easily? #5

jackywu opened this issue Mar 24, 2024 · 1 comment

Comments

@jackywu
Copy link

jackywu commented Mar 24, 2024

hi, it's a magic project, thanks for your good job.
I have a small question. how to calculate what percentage the price rise from A USD to B USD ?
in normal way (B-A)/A * 100, I hope we have a more concise way.

@idanpa
Copy link
Owner

idanpa commented Mar 24, 2024

Hi @jackywu! Thanks for writing this issue.

You can define functions and use them, they would persist across sessions.

In [1]: def p(A,B):
   ...:     return (B-A)*100/A
   ...: 
In [2]: p(100,120)
Out[2]: 20.0

If this is not what you are looking for, please let me know what you think.

@idanpa idanpa closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants