Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- budget = float(input())
- students = int(input())
- flour_price = float(input())
- egg_price = float(input())
- apron_price = float(input())
- flour_discount = 0
- total_flour_price = students * flour_price
- total_egg_price = egg_price * 10 * students
- total_aprons_price = apron_price * (math.ceil(students * 1.2))
- for student in range(1, students + 1):
- if student % 5 == 0:
- flour_discount += flour_price
- total_price = (total_flour_price - flour_discount) + total_egg_price + total_aprons_price
- if total_price <= budget:
- print(f"Items purchased for {total_price:.2f}$.")
- else:
- print(f"{abs(budget - total_price):.2f}$ more needed.")
Advertisement
Add Comment
Please, Sign In to add comment