Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (Retired) Ins & Outs Ins & Outs

NameError

Why is my name 'name' incorrect? I did it exactly as the video showed.

2 Answers

Just type:

name = "name"

It has to have quotes around it so that python knows that it is a string. Strings are basically words, sentences or paragraphs. Just think of strings as letters and spaces tied together to make a sentence or a word.

Hi Shayler,

It sounds like you entered:

name = name

In Python, this is the equivalent of saying that you want to assign the variable called name to the variable called name. Or to be more clear, name = Shayler would tell Python you are assigning the variable called Shayler to the variable called name.

You need to surround strings with quotation marks so that Python understands that you're referencing a string, not a variable. In this instance, you'd pass with:

name = "name"

or alternatively;

name = 'name'