Advertisement
Guest User

02. Christmas Market

a guest
Dec 12th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. import math;
  2.  
  3. moneyToSave = float(input())
  4. numOfFantasyBooks = int(input())
  5. numOfHorrorBooks = int(input())
  6. numOfRomanceBooks = int(input())
  7.  
  8.  
  9. income = numOfFantasyBooks * 14.90 + numOfHorrorBooks * 9.80 + numOfRomanceBooks * 4.30;
  10. income -= income * 0.20;
  11. moneyForSellers = 0;
  12.  
  13. if (income >= moneyToSave):
  14.     moneyForSellers = math.floor((income - moneyToSave)*0.1);
  15.     income -= moneyForSellers;
  16.     print(f"{income:.2f} leva donated.");
  17.     print(f"Sellers will receive {moneyForSellers} leva.");
  18. else:
  19.     diff = moneyToSave - income;
  20.     print(f"{diff:.2f} money needed.");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement