Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left
Apply NowLogin using Social Account
     Continue with GoogleLogin using your credentials
In this step, we will assign the pieces to the players. Depending on whether the player chooses to go first, we would assign them the symbols X
or O
.
Define a function pieces
to assign the symbols X
or O
to the players:
def <<your code goes here>>():
go_first = ask_question("Do you want to go first? (y/n): ")
if go_first == "y":
print("\nGreat! Let the game begin.")
human = X
computer = O
else:
print("\nAlright. I will go first. Wish you all the best!")
computer = X
human = O
return computer, human
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Note - Having trouble with the assessment engine? Follow the steps listed here
Loading comments...