Advertisement
GalinaKG

Tic-Tac-Toe

Jun 5th, 2022
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.99 KB | None | 0 0
  1. first_line = input().split(' ')
  2. second_line = input().split(' ')
  3. third_line = input().split(' ')
  4.  
  5. first = '1'
  6. second = '2'
  7.  
  8. if first == first_line[0] and first == first_line[1] and first == first_line[2]:
  9.     print('First player won')
  10. elif first == second_line[0] and first == second_line[1] and first == second_line[2]:
  11.     print('First player won')
  12. elif first == third_line[0] and first == third_line[1] and first == third_line[2]:
  13.     print('First player won')
  14. elif first == first_line[0] and first == second_line[0] and first == third_line[0]:
  15.     print('First player won')
  16. elif first == first_line[1] and first == second_line[1] and first == third_line[1]:
  17.     print('First player won')
  18. elif first == first_line[2] and first == second_line[2] and first == third_line[2]:
  19.     print('First player won')
  20. elif first == first_line[0] and first == second_line[1] and first == third_line[2]:
  21.     print('First player won')
  22. elif first == first_line[2] and first == second_line[1] and first == third_line[0]:
  23.     print('First player won')
  24. elif second == first_line[0] and second == first_line[1] and second == first_line[2]:
  25.     print('Second player won')
  26. elif second == second_line[0] and second == second_line[1] and second == second_line[2]:
  27.     print('Second player won')
  28. elif second == third_line[0] and second == third_line[1] and second == third_line[2]:
  29.     print('Second player won')
  30. elif second == first_line[0] and second == second_line[0] and second == third_line[0]:
  31.     print('Second player won')
  32. elif second == first_line[1] and second == second_line[1] and second == third_line[1]:
  33.     print('Second player won')
  34. elif second == first_line[2] and second == second_line[2] and second == third_line[2]:
  35.     print('Second player won')
  36. elif second == first_line[0] and second == second_line[1] and second == third_line[2]:
  37.     print('Second player won')
  38. elif second == first_line[2] and second == second_line[1] and second == third_line[0]:
  39.     print('Second player won')
  40. else:
  41.     print('Draw!')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement