NameError: name 'h or anything' is not defined

Hello,

i'm very new in this programming/coding environment. but in the beginning i'm facing some challenges. i'm following some youtube tutorials to learn Python on PyCharm from few days and yesterday while pronting a list i got a continuous NameError:'h' not found. or 'e' not found. 
is there anyone who has faced the same kind of issue. if yes then please comment how to fix this issue.

0
1 comment

Hello,

This is expectable. You see, in your code, you have a variable "a" with a list of other variables which are not defined anywhere. 

To make it work, you must add quotes to all the letters inside your list; this will show the Python interpreter that those are actually strings.

It should be something like this:

a = ["h", "e", "l", "l", "o"]

print(a)

You can find more helpful information about Python variables and data types on our learning platform.

0

Please sign in to leave a comment.