Spocoman

Game Number Wars

Feb 24th, 2022 (edited)
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. player1 = input()
  2. player2 = input()
  3. point1 = 0
  4. point2 = 0
  5.  
  6. while True:
  7.     command = input()
  8.     if command == "End of game":
  9.         print(f"{player1} has {point1} points")
  10.         print(f"{player2} has {point2} points")
  11.         break
  12.        
  13.     card01 = int(command)
  14.     card02 = int(input())
  15.  
  16.     if card01 > card02:
  17.         point1 += card01 - card02
  18.     elif card01 < card02:
  19.         point2 += card02 - card01
  20.     else:
  21.         card01 = int(input())
  22.         card02 = int(input())
  23.         print("Number wars!")
  24.         if card01 > card02:
  25.             print(f"{player1} is winner with {point1} points")
  26.         else:
  27.             print(f"{player2} is winner with {point2} points")
  28.         break
  29.        
Add Comment
Please, Sign In to add comment