Hi
I am taking input from user and when I run this code I get the error. Please help what I am doing wrong here.
I followed other post and issue is fixed. I am using python 2 and I should use raw_input in place of input function. Below code worked.
I am taking input from user and when I run this code I get the error. Please help what I am doing wrong here.
print('Please enter some text:') x = input() print('Text entered:', x) print('Type:', type(x))
Error:Please enter some text:
vijay
Traceback (most recent call last):
File "C:/Program Files/Python/First.py", line 5, in <module>
x = input()
File "<string>", line 1, in <module>
NameError: name 'vijay' is not defined
>>>
I followed other post and issue is fixed. I am using python 2 and I should use raw_input in place of input function. Below code worked.
print('Please enter some text:') x = raw_input() print('Text entered:', x) print('Type:', type(x))