sibinasto

Untitled

Jan 26th, 2021
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.66 KB | None | 0 0
  1. line_one = input().split()
  2. line_two = input().split()
  3. line_three = input().split()
  4.  
  5. first_player_won = False
  6. second_player_won = False
  7.  
  8. if line_one[0] == line_one[1] == line_one[2]:
  9.     if line_one[0] == "1":
  10.         first_player_won = True
  11.     elif line_one[0] == "2":
  12.         second_player_won = True
  13.  
  14. elif line_two[0] == line_two[1] == line_two[2]:
  15.     if line_two[0] == "1":
  16.         first_player_won = True
  17.     elif line_two[0] == "2":
  18.         second_player_won = True
  19.  
  20. elif line_three[0] == line_three[1] == line_three[2]:
  21.     if line_three[0] == "1":
  22.         first_player_won = True
  23.     elif line_three[0] == "2":
  24.         second_player_won = True
  25.  
  26. elif line_one[0] == line_two[0] == line_three[0]:
  27.     if line_one[0] == "1":
  28.         first_player_won = True
  29.     elif line_one[0] == "2":
  30.         second_player_won = True
  31.  
  32. elif line_one[1] == line_two[1] == line_three[1]:
  33.     if line_one[1] == "1":
  34.         first_player_won = True
  35.     elif line_one[1] == "2":
  36.         second_player_won = True
  37.  
  38. elif line_one[2] == line_two[2] == line_three[2]:
  39.     if line_one[2] == "1":
  40.         first_player_won = True
  41.     elif line_one[2] == "2":
  42.         second_player_won = True
  43.  
  44. elif line_one[0] == line_two[1] == line_three[2]:
  45.     if line_one[0] == "1":
  46.         first_player_won = True
  47.     elif line_one[0] == "2":
  48.         second_player_won = True
  49.  
  50. elif line_one[2] == line_two[1] == line_three[0]:
  51.     if line_one[2] == "1":
  52.         first_player_won = True
  53.     elif line_one[2] == "2":
  54.         second_player_won = True
  55.  
  56. if first_player_won:
  57.     print("First player won")
  58. elif second_player_won:
  59.     print("Second player won")
  60. else:
  61.     print("Draw!")
Advertisement
Add Comment
Please, Sign In to add comment