Advertisement
bl00dt3ars

06. Tic-Tac-Toe

May 29th, 2021
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. first_row = [int(el) for el in input().split()]
  2. second_row = [int(el) for el in input().split()]
  3. third_row = [int(el) for el in input().split()]
  4.  
  5. if first_row[0] == 1 and first_row[1] == 1 and first_row[2] == 1 \
  6.     or second_row[0] == 1 and second_row[1] == 1 and second_row[2] == 1 \
  7.     or third_row[0] == 1 and third_row[1] == 1 and third_row[2] == 1 \
  8.     or first_row[0] == 1 and second_row[0] == 1 and third_row[0] == 1 \
  9.     or first_row[1] == 1 and second_row[1] == 1 and third_row[1] == 1 \
  10.     or first_row[2] == 1 and second_row[2] == 1 and third_row[2] == 1 \
  11.     or first_row[0] == 1 and second_row[1] == 1 and third_row[2] == 1 \
  12.     or first_row[2] == 1 and second_row[1] == 1 and third_row[0] == 1:
  13.     print("First player won")
  14. elif first_row[0] == 2 and first_row[1] == 2 and first_row[2] == 2 \
  15.    or second_row[0] == 2 and second_row[1] == 2 and second_row[2] == 2 \
  16.    or third_row[0] == 2 and third_row[1] == 2 and third_row[2] == 2 \
  17.    or first_row[0] == 2 and second_row[0] == 2 and third_row[0] == 2 \
  18.    or first_row[1] == 2 and second_row[1] == 2 and third_row[1] == 2 \
  19.    or first_row[2] == 2 and second_row[2] == 2 and third_row[2] == 2 \
  20.    or first_row[0] == 2 and second_row[1] == 2 and third_row[2] == 2 \
  21.    or first_row[2] == 2 and second_row[1] == 2 and third_row[0] == 2:
  22.     print("Second player won")
  23. else:
  24.     print("Draw!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement