Advertisement
Guest User

Untitled

a guest
Nov 1st, 2019
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. participants_number = int(input())
  2.  
  3. all_cookies = 0
  4. all_cakes = 0
  5. all_waffles = 0
  6.  
  7. for x in range(participants_number):
  8.     name = input()
  9.  
  10.     cookies = 0
  11.     cakes = 0
  12.     waffles = 0
  13.  
  14.     while True:
  15.         pastries_type = input()
  16.  
  17.         if pastries_type == 'Stop baking!':
  18.             print(f"{name} baked {cookies} cookies, {cakes} cakes and {waffles} waffles.")
  19.             break
  20.  
  21.  
  22.         number_of_pastries = int(input())
  23.  
  24.         if pastries_type == 'cookies':
  25.             cookies += number_of_pastries
  26.             all_cookies += cookies
  27.         elif pastries_type == 'cakes':
  28.             cakes += number_of_pastries
  29.             all_cakes += cakes
  30.         elif pastries_type == 'waffles':
  31.             waffles += number_of_pastries
  32.             all_waffles += waffles
  33.  
  34. baked_pastries = all_cookies + all_cakes + all_waffles
  35. price_baked_pastries = (all_cookies * 1.5) + (all_cakes * 7.8) + (all_waffles * 2.3)
  36.  
  37. print(f"All bakery sold: {baked_pastries}")
  38. print(f"Total sum for charity: {price_baked_pastries:.2f} lv.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement