Login using Social Account
     Continue with GoogleLogin using your credentials
In this step we will define the constants that we would be using throughout this program. These are called Global Constants
in Python since as we are declaring them outside any function.
How to define a constant in Python? You can define a constant in Python as shown below:
SOME_CONSTANT = [...]
These constants can be accessed from other file too! If the file name where these constants are declared is firstfile.py
, then you can access to it from other files using the following code (assuming they are in the same directory):
import firstfile
print firstfile.SOME_CONSTANT
In our program, we would define a total of 5 constants, let's start coding!
Simply copy paste the entire code:
X = "X"
O = "O"
EMPTY = " "
TIE = "TIE"
NUM_SQUARES = 9
Here, X
and O
marks the symbols we would use to play the game of Tic Tac Toe. EMPTY
defines an empty variable. TIE
variable is there to check if the match is a draw. Finally, NUM_SQUARES
defines the total number of squares in a game of Tic Tac Toe.
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...