CONDITIONAL LOGIC IN PYTHON
If you have written code in other programming languages, you have undoubtedly seen if/then/else (or if-elseif-else) conditional statements. Although the syntax varies between languages, the logic is essentially the same. The following example shows you how to use if/elif statements in Python:
>>> x = 25
>>> if x < 0:
... print('negative')
... elif x < 25:
... print('under 25')
... elif x == 25:
... print('exactly 25')
... else:
... print('over 25')
...
exactly 25
The preceding code block illustrates how to use multiple conditional statements, and the output is exactly what you expected.