Python Question - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Python Question (/thread-24689.html) |
Python Question - Lighaldr - Feb-27-2020 First of all, I am new here so I am sorry if I am posting in the wrong place, and I would appreciate a link to the write place so I can perform correctly in the future. I am learning python and have bought a book but I am confused about the 'input' command. In the book it has the code: name = input("Hi, what's your name? "), but when I run this and enter any response (in this case the name Sam) I get the error: Traceback (most recent call last): File "/home/pi/Desktop/Newseession.py", line 1, in <module> name = input("Hi, what is your name? ") File "<string>", line 1, in <module> NameError: name 'Sam' is not definedAm I missing something? Thank you for any help. RE: Python Question - buran - Feb-27-2020 this code is python3 and you are running it with python2 read https://python-forum.io/Thread-Python3-2-differences-input-vs-raw-input you should be using python3 as python2 support ended january 1st RE: Python Question - Lighaldr - Mar-02-2020 (Feb-27-2020, 07:51 PM)Lighaldr Wrote: First of all, I am new here so I am sorry if I am posting in the wrong place, and I would appreciate a link to the write place so I can perform correctly in the future. Thanks |