Python Forum

Full Version: input error help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.


name = input("Enter Name: ")
print("Hello there "+name)

input("Press enter")
I'm encountering an error with this command. When I get the "Enter name" prompt and I enter
Me (Or anything else)
I get this error:
Error:
Traceback (most recent call last): File "G:\Python Saves\Tests\Hello.py", line 1, in <module> name = input("Enter Name: ") File "<string>", line 1, in <module> NameError: name 'Me' is not defined
However, if I enter
"Me" instead, it works. I know it should work without "" but for some reason, it doesn't.
Can anyone help me out with this?

I am running on windows 10.
Use code tag BBcode help.

You are getting that error because you use Python 2.
Fix:
name = raw_input("Enter Name: ")
print("Hello there " + name)
But you should really use Python 3,follow Python 3.6 and pip installation under Windows.
Then it can look like this.
name = input("Enter Name: ")
print(f'Hello there {name}')
I see. I downloaded python 3 but it would seem I was using an old installation. I guess that is a newbie for you haha, thank you so much.