MariyanGrigorov

More Exercises: Lists Basics-Tic-Tac-Toe

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