0

How does the "elif" work đŸ˜„ in python

I have been trying to understand it but can't

26th Sep 2020, 1:37 PM
Thato Mahlangu
Thato Mahlangu - avatar
3 Answers
+ 2
Just think of it as being short for "else if". It doesn't mean anything special beyond being a short form for "else if" Do you know what else and if mean?
26th Sep 2020, 1:39 PM
Josh Greig
Josh Greig - avatar
+ 2
Yo said: " So is it like ...if "if" evaluates False .Python checks the condition of elif ?" Yes. If you understand "else", you should understand elif. A little example: x = 3 if x == 3: print('3') elif x == 4: print('4') else: print('something else')
26th Sep 2020, 4:45 PM
Josh Greig
Josh Greig - avatar
+ 1
So is it like ...if "if" evaluates False .Python checks the condition of elif ?
26th Sep 2020, 1:42 PM
Thato Mahlangu
Thato Mahlangu - avatar