Printing number but when entering string showing error string not defined

a = input("enter ")
print(a)
#when igiving input as number it is printing but when I try to give string as input it is showing error as “string not defined”

Please show the full code and the full traceback (error message). The code you’ve shown won’t care if you type in a number or letters.

Why are you using Python 2? That is obsolete. You should be using Python version 3.

If you must continue using Python 2 for some reason, use raw_input instead of input.

2 Likes