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 trialPedro Barajas
1,602 PointsNameError, Please Help!
This code works on Launch Workplace, however it doesn't work on PyCharm or VSCode.
first_name = input("What is your first name? ") print("Hello,", first_name) if first_name == "Caitlin": print(first_name, "is learning Python") print("Have a great day {}!".format(first_name))
This is the error that I get on PyCharm and VSCode File "index.py", line 25, in <module> first_name = input("What is your first name? ") File "<string>", line 1, in <module> NameError: name 'Caitlin' is not defined I don't understand exactly what I am doing wrong.
1 Answer
Tim Albertson
2,823 PointsHi Pedro,
I'm not sure why that error is happening. How exactly are you running your code in VS Code? I ran the same code in VS Code and didn't get any errors.
Stephen Williams
3,372 PointsStephen Williams
3,372 PointsHi Pedro! this is what I came up with, I tried it in VS Code and it runs with no errors...
first_name = input("What is your first name? ") print("Hello, {}".format(first_name))
if first_name == "Caitlin": print("{} is learning Python".format(first_name)) print("Have a great day {}!".format(first_name))