Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Python Basics All Together Now Gather Information

So why is my code accepted and ok in the treehouse workspace but not in my VS code editor??

its the exact same code but not working the same , is there something I am missing??

the workspace ; https://w.trhou.se/63e7h80afw

this is what VS code says ..

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\distj\Desktop\DeskTop\resources\treehouse\26.python\project1> python masterticket.py There are 100 tickets left. What is your name? diana Traceback (most recent call last): File "masterticket.py", line 7, in <module> name = input("What is your name? ") File "<string>", line 1, in <module> NameError: name 'diana' is not defined

2 Answers

Josh Keenan
Josh Keenan
19,426 Points

Try using, python3 masterticket.py, workspaces is using python 3 by default, but the python command on a local machine would default to using python 2.7 if I am not mistaken. In python 2 the raw_input() function would be needed to get string based input.

[alt text](C:\Users\distj\Desktop\DeskTop\resources\treehouse\26.python\img "15.jpg")