tod36

06. Baking competition

Feb 23rd, 2020
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.19 KB | None | 0 0
  1. numb_of_participant = int(input())
  2. price_of_one = 0
  3. all_sweet = 0
  4. all_price = 0
  5. pastry_type = ""
  6. numb_of_cookies = 0
  7. numb_of_cakes = 0
  8. numb_of_waffles = 0
  9.  
  10. for i in range(1, numb_of_participant +1):
  11.     name_of_participant = input()
  12.     pastry_type = input()
  13.     while pastry_type != "Stop baking!":
  14.         name_of_sweet = pastry_type
  15.         numb_of_sweet = int(input())
  16.         if name_of_sweet == "cookies":
  17.             price_of_one = numb_of_sweet * 1.50
  18.             numb_of_cookies += numb_of_sweet
  19.         elif name_of_sweet == "cakes":
  20.             price_of_one = numb_of_sweet * 7.80
  21.             numb_of_cakes += numb_of_sweet
  22.         elif name_of_sweet == "waffles":
  23.             price_of_one = numb_of_sweet * 2.30
  24.             numb_of_waffles += numb_of_sweet
  25.         all_sweet += numb_of_sweet
  26.         all_price += price_of_one
  27.         pastry_type = input()
  28.  
  29.     print(f"{name_of_participant} baked {numb_of_cookies} cookies, {numb_of_cakes} cakes and {numb_of_waffles} waffles.")
  30.     numb_of_cookies = 0
  31.     numb_of_cakes = 0
  32.     numb_of_waffles = 0
  33.     name_of_sweet = ""
  34.     i += 1
  35. print(f"All bakery sold: {all_sweet}")
  36. print(f"Total sum for charity: {all_price:.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment