Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- budget = float(input())
- students = int(input())
- price_of_flour = float(input())
- price_of_egg = float(input())
- price_of_apron = float(input())
- price_apron_real = price_of_apron * (math.ceil(students + students * 0.20))
- price_for_needed_item = price_apron_real + price_of_egg * 10 * students + price_of_flour * students
- for num in range(1, students+1):
- if num % 5 == 0:
- price_for_needed_item -= price_of_flour
- diferrence = abs(budget - price_for_needed_item)
- if diferrence <= budget:
- print(f"Items purchased for: {price_for_needed_item:.2f}$.")
- else:
- print(f"{diferrence:.2f}$ more needed.")
Advertisement
Add Comment
Please, Sign In to add comment