exDotaPro

20_april_2019_4_easter_eggs_battle

Jan 5th, 2020
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.90 KB | None | 0 0
  1. player_one_eggs = int(input())
  2. player_two_eggs = int(input())
  3.  
  4. player_one_out_of_eggs = False
  5. player_two_out_of_eggs = False
  6.  
  7. command = input()
  8.  
  9. while command != 'End of battle':
  10.     if command == 'one':
  11.         player_two_eggs -= 1
  12.     elif command == 'two':
  13.         player_one_eggs -= 1
  14.  
  15.     if player_one_eggs == 0:
  16.         player_one_out_of_eggs = True
  17.     elif player_two_eggs == 0:
  18.         player_two_out_of_eggs = True
  19.  
  20.     if player_one_out_of_eggs:
  21.         print(f'Player one is out of eggs. Player two has {player_two_eggs} eggs left.')
  22.         break
  23.     elif player_two_out_of_eggs:
  24.         print(f'Player two is out of eggs. Player one has {player_one_eggs} eggs left.')
  25.         break
  26.  
  27.     command = input()
  28.  
  29.     if command == 'End of battle':
  30.         print(f'Player one has {player_one_eggs} eggs left.')
  31.         print(f'Player two has {player_two_eggs} eggs left.')
  32.         break
Advertisement
Add Comment
Please, Sign In to add comment