simeonshopov

Baking Competitions (late july exam)

Nov 6th, 2019
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. players = int(input())
  2. sum_total = 0
  3. total_baked = 0
  4.  
  5. for i in range(1, players + 1):
  6.   name = input()
  7.   item = input()
  8.   cookies = 0
  9.   cakes = 0
  10.   waffles = 0
  11.   while item != "Stop baking!":
  12.     count = int(input())
  13.     if item == "cookies":
  14.       cookies += count
  15.       sum_total += count * 1.50
  16.     elif item == "cakes":
  17.       cakes += count
  18.       sum_total += count * 7.80
  19.     elif item == "waffles":
  20.       waffles += count
  21.       sum_total += count * 2.30
  22.     total_baked += count
  23.     item = input()
  24.   else:
  25.     print(f"{name} baked {cookies} cookies, {cakes} cakes and {waffles} waffles.")
  26. print(f"All bakery sold: {total_baked}")
  27. print(f"Total sum for charity: {sum_total:.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment