I am stuck with my first exercise


Strings & Console Output

Traceback (most recent call last):
File "python", line 1, in
NameError: name 'caesar' is not defined

This is what I typed in:
my_variable = caesar
caesar = Graham
my_variable = praline
praline = John
my_variable = viking
viking = Teresa

Replace this line with your code.


The above (and the other two instances) are calling a variable that is not defined until the next line. Reverse the order of the two lines in all three cases.

More to the point, what are the instructions? Please post a link to the exercise. Thank you.


Hi thank you so much for taking the time to reply. the link to the exercise, if i have it correct is: https://www.codecademy.com/courses/python-beginner-sRXwR/0/2?curriculum_id=4f89dab3d788890003000096#

I did try and reverse the order as follows and I still get an error message see it pasted below this script

ceasar = Graham
my_variable = caesar
praline = John
my_variable = praline
viking = Teresa
my_variable = viking


Hi, @corepro94807 ,

Surround string literals with quotes. You can assign a string to a variable, as follows ...

caesar = "Graham"

Make sure that you spell the names of variables as specified in the instructions.

Always post a link to the exercise, as @mtf has stated. It makes it easier for users to help.


Hi I tried inserting "" around each of the variables and i am still getting an error message. I must be doing something really silly


The spelling of caesar is different at the variable declaration and print statement


Just a short note to say thank you so much for your assistance, and apologies that it was such a basic oversight on my part that requires the query. LESSON LEANED: check once check again and then then check again when writing code. Best regards and have a great day


We all have been there and still have come across such oversight even after many years. The advantage is you spend very little time in debugging such issues since you have seen many variants :slight_smile:

So keep practising and don't give up hope!