Advertisement
miglenabs

Untitled

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