Advertisement
Guest User

baking_competition

a guest
Feb 22nd, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.11 KB | None | 0 0
  1. bakers_count = int(input())
  2.  
  3. cookies_count = 0
  4. cakes_count = 0
  5. waffles_count = 0
  6.  
  7. for baker in range(bakers_count):
  8.     baker_cookies_count = 0
  9.     baker_cakes_count = 0
  10.     baker_waffles_count = 0
  11.  
  12.     baker_name = input()
  13.     sweetie = input()
  14.  
  15.     while sweetie != 'Stop baking!':
  16.         sweetie_count = int(input())
  17.  
  18.         if sweetie == 'cookies':
  19.             cookies_count += sweetie_count
  20.             baker_cookies_count += sweetie_count
  21.         elif sweetie == 'cakes':
  22.             cakes_count += sweetie_count
  23.             baker_cakes_count += sweetie_count
  24.         elif sweetie == 'waffles':
  25.             waffles_count += sweetie_count
  26.             baker_waffles_count += sweetie_count
  27.  
  28.         sweetie = input()
  29.  
  30.     print(f'{baker_name} baked {baker_cookies_count} cookies, {baker_cakes_count} cakes and {baker_waffles_count} waffles.')
  31.  
  32. all_bakery_count = cookies_count + cakes_count + waffles_count
  33. sum_for_charity = cookies_count * 1.50 + cakes_count * 7.80 + waffles_count * 2.30
  34.  
  35. print(f'All bakery sold: {all_bakery_count}')
  36. print(f'Total sum for charity: {sum_for_charity:.2f} lv.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement