Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- line1 = input().split()
- line2 = input().split()
- line3 = input().split()
- winner = " "
- if (set(line1) == {"1"} and len(set(line1)) == 1) or (set(line2) == {"1"} and len(set(line2)) == 1) or (set(line3) == {"1"} and len(set(line3)) == 1):
- winner = "First"
- elif (set(line1) == {"2"} and len(set(line1)) == 1) or (set(line2) == {'2'} and len(set(line2)) == 1) or (set(line3) == {"2"} and len(set(line3)) == 1):
- winner = "Second"
- for col in range(len(line2)):
- if line1[col] == line2[col] == line3[col] == "1":
- winner = "First"
- break
- elif line1[col] == line2[col] == line3[col] == "2":
- winner = "Second"
- break
- col = 0
- if line1[col] == line2[col + 1] == line3[col + 2] == "1" or line1[col + 2] == line2[col + 1] == line3[col] == "1":
- winner = "First"
- elif line1[col] == line2[col + 1] == line3[col + 2] == "2" or line1[col + 2] == line2[col + 1] == line3[col] == "2":
- winner = "Second"
- if winner == " ":
- print("Draw!")
- else:
- print(f"{winner} player won")
Advertisement
Add Comment
Please, Sign In to add comment