MicrolearnENPTES

Many cases with elif

Lesson 7 of 20 · Py.Micro

Check conditions in order and stop at the first true one.

elif means "else if". Python tests each condition from the top and runs only the first block whose condition is true.

Check yourself

With score = 95 and tests >= 50, >= 70, >= 90 in that order, which runs?

Do it in the browser: a real Python tool, a short mission and instant feedback. No install.

Start this lesson — free
← if and elseand, or, not →

All lessons · Py.Micro