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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Victor A Hernandez](https://secure.gravatar.com/avatar/c714b63fac9c9978fb270e16ae4ab91e?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Victor A Hernandez
1,957 Pointselif. What I made wrong with these?. My code does not run.I receive a message: Invalid sintax in line 8.
first_name = input ("What is your first name?")
print ("Hello,", first_name)
if first_name =="Craig":
print (first_name, "is learning Python")
print ("Have a great day {}!" .format (first_name))
else:
print ("You should totally learn Python, {}!" .format (first_name))
elif first_name == "Maximiliano":
print (first_name, "is learning with fellow students in
[MOD:: added ```python formatting -cf]
3 Answers
![Tiffany Greathead](https://secure.gravatar.com/avatar/04559e0d2119d4c804449d553682419f?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tiffany Greathead
6,613 PointsHi Victor,
Your code looks good, you're on the right track. The last line has an elif statement after the else statement, which may be causing your error. Try moving the
elif first_name == "Maximiliano":
print (first_name, "is learning with fellow students in")
above the else statement.
Else statements always come after if and elif statements, they tell the program that if none of the above statements apply, do this. Also, the last line of code is incomplete. It needs to have ending quotation marks and parentheses, unless that part got cut off by accident. Hope this helps
![Victor A Hernandez](https://secure.gravatar.com/avatar/c714b63fac9c9978fb270e16ae4ab91e?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Victor A Hernandez
1,957 PointsThank you Tiffany, I'll do the correction and I'll let you know what happens. The last part of my code was cut by error.
![Victor A Hernandez](https://secure.gravatar.com/avatar/c714b63fac9c9978fb270e16ae4ab91e?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Victor A Hernandez
1,957 Pointselse: print ("You should totally learn Python, {}!" .format (first_name)) else: print ("You should totally learn Python, {}!" .format (first_name)) I made the change , and my code worked. Thank you again Tiffany.
![Tiffany Greathead](https://secure.gravatar.com/avatar/04559e0d2119d4c804449d553682419f?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Tiffany Greathead
6,613 PointsNo problem! Glad it helped
Chris Freeman
Treehouse Moderator 68,425 PointsChris Freeman
Treehouse Moderator 68,425 PointsGood answer Tiffany! Thanks for helping out in the community forum. Comment moved to answer.
Tiffany Greathead
6,613 PointsTiffany Greathead
6,613 PointsThank you, Chris Freeman.
I'll be sure to post it in the right section next time :)