Advertisement
Spocoman

Baking Competition

Oct 6th, 2023 (edited)
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. bakers = int(input())
  2. total_sweets = 0
  3. total_sum = 0.0
  4.  
  5. for i in range(bakers):
  6.     baker = ""
  7.     cookies = 0
  8.     cakes = 0
  9.     waffles = 0
  10.  
  11.     while True:
  12.         command = input()
  13.         if command == "Stop baking!":
  14.             break
  15.         if baker == "":
  16.             baker = command
  17.         else:
  18.             sweet = command
  19.             sweet_count = int(input())
  20.             if sweet == "cookies":
  21.                 cookies += sweet_count
  22.             elif sweet == "cakes":
  23.                 cakes += sweet_count
  24.             else:
  25.                 waffles += sweet_count
  26.  
  27.             total_sweets += sweet_count
  28.  
  29.     total_sum += 1.50 * cookies + 7.80 * cakes + 2.30 * waffles
  30.     print(f"{baker} baked {cookies} cookies, {cakes} cakes and {waffles} waffles.")
  31.  
  32. print(f"All bakery sold: {total_sweets}\nTotal sum for charity: {total_sum:.2f} lv.")
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement