+ 1
nested ifs versus if / elif?
I’ve been doing another Python basics and encountered if - elif more often.... Nested ifs are quite weird for me.
3 Réponses
+ 3
Nested if/else structure is logically equivalent to (and is compiled to the same bytecode as) elif. The latter is generally preferred as being more readable.
https://stackoverflow.com/questions/44728436/difference-between-nested-if-else-and-elif
+ 1
no different than nested ifs in excel
+ 1
Oh I see. Thank you guys!