Advertisement
exDotaPro

20_april_2019_4_easter_shop

Jan 5th, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. starting_eggs = int(input())
  2.  
  3. command = input()
  4. sold_eggs = 0
  5.  
  6. while command != 'Close':
  7.     if command == 'Buy':
  8.         bought_eggs = int(input())
  9.  
  10.         if bought_eggs > starting_eggs:
  11.             print('Not enough eggs in store!')
  12.             print(f'You can buy only {starting_eggs}.')
  13.             break
  14.  
  15.         starting_eggs -= bought_eggs
  16.         sold_eggs += bought_eggs
  17.  
  18.     elif command == 'Fill':
  19.         filled_eggs = int(input())
  20.         starting_eggs += filled_eggs
  21.  
  22.     command = input()
  23.  
  24.     if command == 'Close':
  25.         print('Store is closed!')
  26.         print(f'{sold_eggs} eggs sold.')
  27.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement