Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Kevin Koch
Full Stack JavaScript Techdegree Student 3,767 Pointselif
why is my code not working
first_name = input("What is your name")
print("Hello,", first_name)
if first_name == "mimi":
print(first_name, "is learning python")
elif first_name == "wale":
print(first_name, "is learning with a fellow")
else:
age =input("How old are you")
print("You should totaly learn python, {}!".format(first_name))
print("have a good day{}".format(first_name))
2 Answers

Mark Sebeck
Treehouse Moderator 32,410 PointsI think it might just be formatting. Your if, elif and else need to line up. The prints need to not be indented or will only run if the else clause is executed. Unless the last prints are only suppose to print if the else is run then leave them indented. Let me know if you still need help.
first_name = input("What is your name")
print("Hello,", first_name)
if first_name == "mimi":
print(first_name, "is learning python")
elif first_name == "wale":
print(first_name, "is learning with a fellow")
else:
age =input("How old are you")
print("You should totaly learn python, {}!".format(first_name))
print("have a good day{}".format(first_name))

ronny nguyen
147 Pointsprint("Hello,", first_name) It should be print("Hello", first_name) Yo need to remove ,

ronny nguyen
147 Pointsfirst_name = input("What is your name") print("Hello", first_name) if first_name == "mimi": print(first_name, "is learning python") elif first_name == "wale": print(first_name, "is learning with a fellow") else: age =input("How old are you")
print("You should totaly learn python, {}!".format(first_name)) print("have a good day{}".format(first_name))
Ryan Markey
Front End Web Development Techdegree Student 12,553 PointsRyan Markey
Front End Web Development Techdegree Student 12,553 PointsYour code works perfectly Kevin, the issue you are having is indentation and formatting.
You have:
When it should be:
Remember that python uses indentation and spaces in place of opening and closing curly braces '{ }', code must be properly formatted to work as intended.
Try pasting this inside your workspace and try it out.