Advertisement
Violeta1234

Baking competition

Jan 2nd, 2020
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.14 KB | None | 0 0
  1.  
  2. participants = int(input())
  3. total_pastry_count = 0
  4. sum_for_charity = 0
  5. cookie = 1.5
  6. cake = 7.8
  7. waffle = 2.3
  8. cookie_count = 0
  9. cake_count = 0
  10. waffle_count = 0
  11.  
  12. for person in range(1, participants +1):
  13.     name = input()
  14.     cookie_count = 0
  15.     cake_count = 0
  16.     waffle_count = 0
  17.     while True:
  18.          type_pastry = input()
  19.          if type_pastry == 'Stop baking!':
  20.              break
  21.          elif type_pastry == "cookies":
  22.              cookie_count = int(input())
  23.              sum = cookie * cookie_count
  24.              sum_for_charity += sum
  25.          elif type_pastry == "cakes":
  26.              cake_count = int(input())
  27.              sum = cake * cake_count
  28.              sum_for_charity += sum
  29.          elif type_pastry == "waffles":
  30.              waffle_count = int(input())
  31.              sum = waffle * waffle_count
  32.              sum_for_charity += sum
  33.     total_pastry_count += cookie_count + cake_count + waffle_count
  34.     print(f"{name} baked {cookie_count} cookies, {cake_count} cakes and {waffle_count} waffles.")
  35.    
  36. print(f"All bakery sold: {total_pastry_count}")
  37. print(f"Total sum for charity: {sum_for_charity:.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement