Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPitrov Secondary
5,121 PointsThis Does not work on VS Code
I did the same as in the video but it says that name I puyt in it says [name] is not defined
3 Answers
Pitrov Secondary
5,121 PointsI found out how to fix it, When i answer the prompt I have to answer in ' ' , but why do I have to do it?
Robert Hosner
Courses Plus Student 3,935 PointsSo the issue is with python versions.
It seems we were using python2, which means we would need to use raw_input
instead of input
for it to work correctly.
In python3, it should work the way it does in the video.
Pitrov Secondary
5,121 PointsRobert Hosner, are you using VS code too? The way I figured it out was by first installing the Python extension, then on the code that you want to run you right-click, and find 'Run Python File in Terminal' when you click it, it should automatically write down /usr/bin/python3.6 {file path} and then when you need to run it again you can just go to the Terminal and press up arrow, to get it up. Hope it works.
The right way you should do it is by changing your environment. I did not get it to work, so I do not know how to do it. but that's how you actually should do it. Try just searching for how to change python environment or something. Good luck.
Robert Hosner
Courses Plus Student 3,935 PointsRobert Hosner
Courses Plus Student 3,935 PointsI have the same issue that dskellth has. Replying without single quotes returns the error:
firstName = input("How are you today? ") File "<string>", line 1, in <module> NameError: name 'Great' is not defined