Guest User

profit loss

a guest
May 3rd, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. buying_price = float(input("Enter the buying price.\n"))
  2.  
  3. selling_price = float(input("Enter the selling price\n"))
  4.  
  5. #Formula for calculating profit percent is (sellingprice - costprice)/costprice * 100.
  6. #For loss, the percent remains same but in negative.
  7. percent_change = (selling_price - buying_price)/buying_price * 100
  8.  
  9. if percent_change <10 and percent_change > -10:
  10.     print("Eh, just another normal day in trading.")
  11. if percent_change >= 10:
  12.     print("Congratulations! You are rich.")
  13. if percent_change <= -10:
  14.     print("Oh no! You are broke.")
Add Comment
Please, Sign In to add comment