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!
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 trial

Kareem Saleh
225 PointsMy python code works perfectly on workspace but not on my mac when i tried to run it through the console, any ideas?
It gives me the following error:
What is your first name? Kareem Traceback (most recent call last): File "hello.py", line 1, in <module> first_name = input("What is your first name? \n") File "<string>", line 1, in <module> NameError: name 'Kareem' is not defined
Here's the code:
first_name = input("What is your first name? \n")
print('Hello,',first_name.capitalize())
if first_name.lower() == "kareem": print(first_name.capitalize(),'is learning Python')
elif first_name.lower() == "maximilliane": print(first_name.capitalize(), "is learning with fellow students in the community! Me too!")
else: # This is just in case we have a younger user who can't yet read. age = int(input("How old are you?\n")) if age <=6: print("Wow you're {}! If you are confident with your reading already...".format(age)) print ("You should totally learn Python, {}".format(first_name.capitalize())) print("Have a Great day {}!".format(first_name.capitalize()))
2 Answers

youssef b10ta
Courses Plus Student 2,755 Pointstry to use this on your mac python3 hello.py

Matthew Scott
5,525 PointsYou will have different versions of python running on each machine.

Kareem Saleh
225 PointsThank you!
Kareem Saleh
225 PointsKareem Saleh
225 PointsIt actually worked, thank you!
Kareem Saleh
225 PointsKareem Saleh
225 Pointslink to download python3:
https://www.python.org/downloads/release/python-381/