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 Python Basics Types and Branching Use an if

Indra Bergmans
Indra Bergmans
2,199 Points

Not grasping If, Else and Elif.

I watched the video for this subject several times but I'm not grasping it and can't put it together. Anyone out there who has some advice?

Greetings Indra

branching.py
favorite_color = input("What is your favorite color?  ")

3 Answers

Steven Parker
Steven Parker
229,644 Points

You might try looking at some of the other questions that have been asked about this same exercise.

Just be aware that code people post will often be incorrect, but sometimes you can learn from their mistakes and/or from the answers.

Jordan DeLeon
Jordan DeLeon
1,074 Points

If and elif require specific actions to continue through their series of events, whereas else says if ANYTHING else happens outside these boundaries (if and elif) then run this other sequence.

Steven Parker
Steven Parker
229,644 Points

FYI: you won't need to worry about "elif" or "else" just yet — this particular challenge doesn't use either.

Indra Bergmans
Indra Bergmans
2,199 Points

Thank you all for answering. Yeah, I shouldn't have attached the code challenge. I just can't seem to grasp the info in the video. I'm going to give it another try with your explanations.

Thank you all!