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

  Enroll Now

Tic Tac Toe with Python - Determine the moves which are legal

Now we will create a function that ensures a move is legal. A move is illegal when a player selects a square which is non-empty.

  • Write a function legal_moves as shown below, it returns a list called moves:

    def <<your code goes here>>(board):
        moves = []
        for square in range(NUM_SQUARES):
            if board[square] == EMPTY:
        return <<your code goes here>>

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...