Python's if...elif statement

      When we write programs, we often make multi-condition judgments. Python's if...elif can perform multi-condition judgment. Note when using if...elif: if judgment will return the first result that satisfies the condition. If you need to return all the results that meet the conditions, this method is not feasible. Here is an example for everyone:

a = 5
if a < 6:
    print('aaa')
elif a < 7:
    print('bbb')

The print result is: aaa

Guess you like

Origin blog.csdn.net/lz_peter/article/details/83791314