Inputting a Name and getting not defined


Hey everyone!

I am using Python 2.6 (PyCharm) and trying to run the following script:

print('Hiya Everybody!')
print('What is your name?')  # ask for their name
myName = input()
print('It is good to meet you, ' + myName)

But after being asked my name and entering my name I get...

Traceback (most recent call last):
  File ".../PycharmProjects/week2/", line 5, in <module>
    myName = input()
  File "<string>", line 1, in <module>
NameError: name 'Dev' is not defined

Process finished with exit code 1

Any ideas as to what may be causing this error? Thanks!


Hey there!
The only thing that caught my eye was this.

myName = input()

Maybe use this instead?

myName = raw_input()

Just saying this because you're using 2.6, while (If i'm correct) input works only in python 3.


That worked, thank you very much!


You are welcome :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.