Can I use the variables from the instructions in my code?


There are variables defined in the instructions, can I use those in my code?


Not unless you define them in your code. Any time you use a variable in your code it must be defined before using it.

If you try writing product = fun_multiplication, for example, you’ll receive an error: NameError: name ‘fun_multiplication’ is not defined. Keep that error message in mind for future projects as well.

1 Like

i didnt get that…how can it be defined before using.

you can’t, variable have to be defined. Otherwise, you get a NameError

can you tell me with an example and explain?

there is an example in the answer of the FAQ:

and indeed, if we attempt to run product = fun_multiplication in a script or the IDLE, we get the NameError

Hey there, I’m new to this stuff as well. It clearly says in the tutorial that in lesson 5 " 'greeting_message = ‘Welcome to Codecademy!’
current_excercise = 5
In the above example, we defined a variable called greeting_message and set it equal to the string ‘Welcome to Codecademy!’. It also defined a variable called current_exercise and set it equal to the number 5."
The variable is the red thing that you type for the date
todays_date =
so in order to use the variables defined in the instructions you have to define them
xxxxxx = 4
fun_math = 2*2
now fun-math equals multiplication and I have to use that variable to do multiplication