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 trialFahad Saleem
Courses Plus Student 10,786 Pointserror error errot
first_name = input("What is your first name? ") print("hello", first_name) if first_name == "craig": print(first_name, " is learning python") else first_name=="omair qasim": print(first_name, "Hey {} you are a great student".format(first_name)
3 Answers
Tom Halff
554 PointsHi there Fahad,
You almost had it working! If you want for the program to include a specific exception aside from the one in your if statement you use elif. I also noticed that you forgot to close the print statement at the end of your code. Have a look at the example below; it should clear things up.
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 == "omair qasim":
print(first_name, "Hey {}, you are a great student".format(first_name))
Moderator Edit: Moved response from Comment section to Answers so it may be upvoted / mark as Best Answer
Fahad Saleem
Courses Plus Student 10,786 PointsTom Halff I am very thank full of you to solve my problem. You are a great person i am become your fan. Thanks, Thanks, Thanks.
Dylan Bailey
574 PointsHey there! Don't forget to check your parentheses when using methods; specifically the format() method.
print(first_name, "Hey {} you are a great student".format(first_name)
The above code is copied from your post. I had errors thrown at me, by forgetting that one parenthesis ?.
print(first_name, "Hey {} you are a great student".format(first_name))