Registrations Closing Soon for DevOps Certification Training by CloudxLab | Registrations Closing in

  Enroll Now

Tic Tac Toe with Python - Create function to determine who would play the first move

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
            print("\nAlright. I will go first. Wish you all the best!")
            computer = X
            human = O
        return computer, human

No hints are availble for this assesment

Answer is not availble for this assesment

Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...