Python NameError: meaning and fix

NameError: Python met a name it does not know.

Code that causes it

name = "민지"
print(nmae)
Open in the runner

The name is misspelled. You used a variable before creating it. The upper and lower case differ.

Find the name from the error higher up and match the spelling. Create a variable before you use it.

How to fix it

name = "민지"
print(name)
Open in the runner

Why it happens

Python reads from top to bottom, one line at a time. A name you have not created yet means nothing to it, so it stops.

The official docs are in English. See it in the official Python docs

Back to the runnerMore errors