Advertisement
PowerCell46

Tic-Tac-Toe checker

Jan 6th, 2023
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.30 KB | None | 0 0
  1. first_row = input().split()
  2. second_row = input().split()
  3. third_row = input().split()
  4.  
  5. if first_row[0] == "1" and first_row[1] == "1" and first_row[2] == "1" or second_row[0] == "1" and second_row[1] == "1" and second_row[2] == "1" or third_row[0] == "1" and third_row[1] == "1" and third_row[2] == "1" or first_row[0] == "1" and second_row[1] == "1" and third_row[2] == "1" or first_row[2] == "1" and second_row[1] == "1" and third_row[0] == "1" or first_row[0] == "1" and second_row[0] == "1" and third_row[0] == "1" or first_row[1] == "1" and second_row[1] == "1" and third_row[1] == "1" or first_row[2] == "1" and second_row[2] == "1" and third_row[2] == "1":
  6.     print("First player won")
  7. elif first_row[0] == "2" and first_row[1] == "2" and first_row[2] == "2" or second_row[0] == "2" and second_row[1] == "2" and second_row[2] == "2" or third_row[0] == "2" and third_row[1] == "2" and third_row[2] == "2" or first_row[0] == "2" and second_row[1] == "2" and third_row[2] == "2" or first_row[2] == "2" and second_row[1] == "2" and third_row[0] == "2" or first_row[0] == "2" and second_row[0] == "2" and third_row[0] == "2" or first_row[1] == "2" and second_row[1] == "2" and third_row[1] == "2" or first_row[2] == "2" and second_row[2] == "2" and third_row[2] == "2":
  8.     print("Second player won")
  9. else:
  10.     print("Draw!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement