0

I have this simple python code which throws errors when i run it. I am not sure what is causing this can somebody help shed some light?

Here is my code file test.py:

name = input("What's your name? ")
print("You are great" + name + "!")
age = input("Your age? ")
print("you look great at" + str(age))

and here is the error:

>>> 
What's your name? kiran

Traceback (most recent call last):
  File "C:\Users\Sunshine\Desktop\test.py", line 1, in <module>
    name = input("What's your name? ")
  File "<string>", line 1, in <module>
NameError: name 'kiran' is not defined
>>> 
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
fiddle
  • 1,095
  • 5
  • 18
  • 33

1 Answers1

1

if you are using Python 2.7 the correct way of getting a string from user input is using the method raw_input(""), input("") is for python 3.