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 trial
Eric Kramer
1,538 PointsI keep getting a line 1 error and I have no idea why
first_name = input("What is your first name? ") print("Hello,", first_name) if first_name == "Craig": print(first_name, "is learning python") elif first_name == "Max": print(first_name, "is learning with fellow students in the Community! Me too!") else: age = int(input("How old are you? ")) if age <= 6: print("Wow you're {}! If you're confident with your reading already...".format(age)) print("You should totally learn Python, {}!".format(first_name)) print("Have a great day {}!".format(first_name))
Eric Kramer
1,538 PointsThanks Steven!
2 Answers
Steven Parker
243,201 PointsI forked (copied) the workspace and ran the program 4 times, giving different inputs, with no errors:
treehouse:~/workspace$ python hello.py
What is your first name? Craig
Hello, Craig
Craig is learning python
Have a great day Craig!
treehouse:~/workspace$ python hello.py
What is your first name? Max
Hello, Max
Max is learning with fellow students in the Community! Me too!
Have a great day Max!
treehouse:~/workspace$ python hello.py
What is your first name? Joe
Hello, Joe
How old are you? 22
You should totally learn Python, Joe!
Have a great day Joe!
treehouse:~/workspace$ python hello.py
What is your first name? Bart
Hello, Bart
How old are you? 5
Wow you're 5! If you're confident with your reading already...
You should totally learn Python, Bart!
Have a great day Bart!
treehouse:~/workspace$
What exactly do you do in the workspace to get the error? Are you perhaps trying to issue the command from within the Python REPL?
Eric Kramer
1,538 Pointspython hello.py
Steven Parker
243,201 PointsI expanded my answer with actual test output. Are you perhaps trying to issue the command from within the Python REPL?
Steven Parker
243,201 PointsSteven Parker
243,201 PointsIndentation is critical for Python. When posting code to the forum, use Markdown formatting to preserve the appearance, or share the entire workspace by making a snapshot and posting the link to it.