Advertisement
Guest User

baking_competition

a guest
Feb 22nd, 2020
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.29 KB | None | 0 0
  1. cookies = 0
  2. cakes = 0
  3. waffles = 0
  4. total_sweeties = 0
  5. current_competitor = ''
  6. next_competitor = False
  7.  
  8. competitors = int(input())
  9.  
  10. for baker in range(1, competitors + 1):
  11.     current_cookies = 0
  12.     current_cakes = 0
  13.     current_waffles = 0
  14.  
  15.     competitor_name = input()
  16.  
  17.     while competitor_name != 'Stop baking!':
  18.         sweetie_type = input()
  19.  
  20.         if sweetie_type == 'Stop baking!':
  21.             next_competitor = True
  22.             break
  23.  
  24.         sweetie_type_count = int(input())
  25.         current_competitor = competitor_name
  26.  
  27.         if sweetie_type == 'cookies':
  28.             current_cookies += sweetie_type_count
  29.             cookies += sweetie_type_count
  30.         elif sweetie_type == 'cakes':
  31.             current_cakes += sweetie_type_count
  32.             cakes += sweetie_type_count
  33.         elif sweetie_type == 'waffles':
  34.             current_waffles += sweetie_type_count
  35.             waffles += sweetie_type_count
  36.  
  37.     if next_competitor:
  38.         print(f'{current_competitor} baked {current_cookies} cookies, {current_cakes} cakes and {current_waffles} waffles.')
  39.  
  40. total_sweeties = cookies + cakes + waffles
  41. for_charity = 1.50 * cookies + 7.80 * cakes + 2.30 * waffles
  42.  
  43. print(f'All bakery sold: {total_sweeties}')
  44. print(f'Total sum for charity: {for_charity:.2f} lv.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement