sibinasto

Problem 1 - Mid Exam

Mar 1st, 2021
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import math
  2.  
  3. budget = float(input())
  4. students = int(input())
  5. price_of_flour = float(input())
  6. price_of_egg = float(input())
  7. price_of_apron = float(input())
  8. price_apron_real = price_of_apron * (math.ceil(students + students * 0.20))
  9. price_for_needed_item = price_apron_real + price_of_egg * 10 * students + price_of_flour * students
  10. for num in range(1, students+1):
  11.     if num % 5 == 0:
  12.            price_for_needed_item -= price_of_flour
  13. diferrence = abs(budget - price_for_needed_item)
  14. if diferrence <= budget:
  15.     print(f"Items purchased for: {price_for_needed_item:.2f}$.")
  16. else:
  17.     print(f"{diferrence:.2f}$ more needed.")
Advertisement
Add Comment
Please, Sign In to add comment