Sichanov

cooking_masterclass

Oct 24th, 2021
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. from math import ceil
  2.  
  3. budget = float(input())
  4. students = int(input())
  5. flour_price = float(input())
  6. egg_price = float(input())
  7. apron_price = float(input())
  8.  
  9. total_flour = flour_price * students - students // 5 * flour_price
  10.  
  11. total_eggs = 10 * egg_price * students
  12.  
  13. total_aprons = ceil(students* 1.2) * apron_price
  14.  
  15. total_sets = total_flour + total_eggs + total_aprons
  16.  
  17. if budget >= total_sets:
  18.     print(f'Items purchased for {total_sets:.2f}$.')
  19. else:
  20.     print(f'{total_sets - budget:.2f}$ more needed.')
Advertisement
Add Comment
Please, Sign In to add comment