Python Forum

Full Version: What might be the cause of this?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is my python code
Name = input("Tell me your name: ")
print("Hello ", Name)
But when i run the program i get this error

C:\Python27>python hello.py
Tell me your name: VIN
Traceback (most recent call last):
  File "hello.py", line 1, in <module>
    Name = input("Tell me your name: ")
  File "<string>", line 1, in <module>
NameError: name 'VIN' is not defined
In python2, input() will try to run whatever you type as if it's python code. You should use raw_input() instead.

In python3, input was removed, and raw_input was renamed to be input, since what you're seeing is almost never what you want.
Also, python2 is nearing it's end of life, and you should probably use a newer version (python3 has been out for almost 10 years at this point). https://pythonclock.org/
Thank you nilamo it worked now. And about python version 3 i will surely follow too.