Enrollments closing soon for Post Graduate Certificate Program in Applied Data Science & AI By IIT Roorkee | 3 Seats Left

  Apply Now

Project- Game of Tic Tac Toe with Python

6 / 16

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.

INSTRUCTIONS
  • 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
    
See Answer

No hints are availble for this assesment


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

Loading comments...