Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sequence_numbers_1 = input().split()
- sequence_numbers_2 = input().split()
- sequence_numbers_3 = input().split()
- line_1 = []
- line_2 = []
- line_3 = []
- for index in range(len(sequence_numbers_1)):
- if sequence_numbers_1[index].isdigit():
- line_1.append(int(sequence_numbers_1[index]))
- for index in range(len(sequence_numbers_2)):
- if sequence_numbers_2[index].isdigit():
- line_2.append(int(sequence_numbers_2[index]))
- for index in range(len(sequence_numbers_3)):
- if sequence_numbers_3[index].isdigit():
- line_3.append(int(sequence_numbers_3[index]))
- # horizontal lines
- if line_1[0] == line_1[1] and line_1[0] == line_1[2]:
- if line_1[0] == 1:
- print("First player won")
- elif line_2[0] == 2:
- print("Second player won")
- elif line_2[0] == line_2[1] and line_2[0] == line_2[2]:
- if line_2[0] == 1:
- print("First player won")
- elif line_2[0] == 2:
- print("Second player won")
- elif line_3[0] == line_3[1] and line_3[0] == line_3[2]:
- if line_3[0] == 1:
- print("First player won")
- elif line_3[0] == 2:
- print("Second player won")
- # vertical lines
- elif line_1[0] == line_2[0] and line_1[0] == line_3[0]:
- if line_1[0] == 1:
- print("First player won")
- elif line_1[0] == 2:
- print("Second player won")
- elif line_1[1] == line_2[1] and line_1[1] == line_3[1]:
- if line_1[1] == 1:
- print("First player won")
- elif line_1[1] == 2:
- print("Second player won")
- elif line_1[2] == line_2[2] and line_1[2] == line_3[2]:
- if line_1[2] == 1:
- print("First player won")
- elif line_1[2] == 2:
- print("Second player won")
- # angle lines
- elif line_1[0] == line_2[1] and line_1[0] == line_3[2]:
- if line_1[0] == 1:
- print("First player won")
- elif line_1[0] == 2:
- print("Second player won")
- elif line_1[2] == line_2[1] and line_1[2] == line_3[0]:
- if line_1[2] == 1:
- print("First player won")
- elif line_1[2] == 2:
- print("Second player won")
- else:
- print("Draw!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement