Advertisement
svephoto

Game Number Wars [python]

Nov 30th, 2019
956
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.05 KB | None | 1 0
  1. player_one = input()
  2. player_two = input()
  3.  
  4. result_player_one = 0
  5. result_player_two = 0
  6.  
  7. input_text = input()
  8.  
  9. while input_text != "End of game":
  10.     card_player_one = int(input_text)
  11.     card_player_two = int(input())
  12.  
  13.     if card_player_one > card_player_two:
  14.         result_player_one += (card_player_one - card_player_two)
  15.  
  16.     if card_player_two > card_player_one:
  17.         result_player_two += (card_player_two - card_player_one)
  18.  
  19.     if card_player_one == card_player_two:
  20.         print("Number wars!")
  21.         card_player_one = int(input())
  22.         card_player_two = int(input())
  23.  
  24.         if card_player_one > card_player_two:
  25.             print(f"{player_one} is winner with {result_player_one} points")
  26.             break
  27.         if card_player_one < card_player_two:
  28.             print(f"{player_two} is winner with {result_player_two} points")
  29.             break
  30.  
  31.     input_text = input()
  32.  
  33. if input_text == "End of game":
  34.     print(f"{player_one} has {result_player_one} points")
  35.     print(f"{player_two} has {result_player_two} points")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement