- 1
Qpython 3: While using input function it prompts for user to enter input but not able read it
>>name=input ('enter your name:') enter your name: Nitin error: name 'Nitin' is not defined
2 ответов
+ 4
This error will be shown on QPython (which implement Python2.7 interpreter), not in QPython3 (which implement Python3)...
In Python2.7, 'input' function/statement doesn't work as 'input' implementation in Python3 (no more a statement, only a function)...
In Python2.7 'raw_input' function is required for getting string user input, else with 'input' Python will try to parse the user entry (in the case you've provided, Python doesn't find a variable named 'Nitin'... if it was found it, you will get its value rather than the name itself ^^)
In Python3, new 'input' behaviour is same as Python2.7 'raw_input' ;P