La Boina Roja

The struggles off a future RHCE….

Leave a comment

If, elif and else explained

The credits for this explanation all go to zlozlozlozlozlozlo a user at reddit. I thought his explanation is worth sharing with you guys null

The if-if-else chain
if A:
>>>do_foo # this gest executed if A evaluates to True
if B:
>>>do_bar #this gest executed if B evaluates to True (regardless of A)
>>>do_baz #this gets executed if B doesn't evaluate to True (again, regardless of A)

The if-elif-else chain:

if A:
>>>do_foo #this gest executed if A evaluates to True
elif B:
>>>do_bar #this gets executed if A doesn't evaluate to True but B does
>>>do_baz # this gest executed if neiter A or B evaluaes to True

Only one of the three is executed in the above if-elif-else chain.

If you need more explanation null there are more people who also did a great job explaining this to me here.


Leave a comment

Join reddit!

Don’t give me that face null


I know it has quite the reputation, but there are some subreddits out there that will help you out while you are learning to program. By this, I don’t mean you should post your homework there and expect some redditor to do it for you null

By reading frequently on some relevant subreddits, you’ll learn so much. Not only about programming but alos on other relevant things you need to know if you are an aspiring programmer. Hell even the touchy feely stuff, like insecurity, is being discussed there and it amazes me how kindly people react to it. The only time I saw someone behave like a jerk, he got called on it by other redditors null

These particular subreddits are also n00b friendly. You can ask a question that has been asked by other many times and no one ever will write something like ” Use the FREAKING search”. Instead they take time to answer the question like it is the first time someone asked this particular question.

The subreddits I am talking about are:

My username there is RojaB and if you must know, no I didn’t create that “drawing” myself.  I can see why you asked though null