Python Forum

Full Version: string name is not defined
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
print("Enter your name:")
x = input()
print("Hello, " + x)
after compiling the program i get this following error

Enter your name:
listingpython
Traceback (most recent call last):
  File "input.py", line 2, in <module>
    x = input()
  File "<string>", line 1, in <module>
NameError: name 'listingpython' is not defined
what version of python? if on python 2 - this code is for python3
read https://python-forum.io/Thread-Python3-2...-raw-input
i am using Python 2.7 thank you for help