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

Python

Hello.py code only sends the response for Craig learning python. im not sure why it won't return the alternate responses

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 == "Maximiliane":
    print (first_name, "is learning 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(first_name, "is learning python")

treehouse:~/workspace$ python hello.py
What is your first name? Hattie
Hello, Hattie
Hattie is learning python
treehouse:~/workspace$ python hello.py
What is your first name? Maximiliane
Hello, Maximiliane
Maximiliane is learning python

Mod Edit: Fixed code formatting, see comment on your other post for how to do this.

2 Answers

rydavim
rydavim
18,813 Points

I'm not getting the same responses that you posted in your test. Your code appears to be behaving as expected for me. I would try closing and re-opening your workspace to see if that fixes the problem. You could also try clearing your browser cache.

If neither of those steps works for you, let me know and we can do some more troubleshooting. On the upside, your code looks good. Nice work!

treehouse:~/workspace$ python hello.py
What is your first name? Hattie
Hello, Hattie
how old are you? 4
wow you're 4! If you're confident with your reading already...
You should totally learn Python, Hattie!
Hattie is learning python
treehouse:~/workspace$ python hello.py
What is your first name? Maximiliane
Hello, Maximiliane
Maximiliane is learning in the community! Me too!
Maximiliane is learning python

I forgot to save it