上篇:https://blog.csdn.net/qq_42489308/article/details/89388218
条件判断
条件判断是通过一条或多条判断语句的执行结果(True或者False)来决定执行的代码块。
在Python语法中,使用if、elif和else三个关键字来进行条件判断。
if语句的一般形式如下所示
if condition1: # condition1为True 执行statement_block_1
statement_block_1
elif condition2: # condition2为True 执行statement_block_2
statement_block_2
else: # 都不是的话执行 statement_block_3
statement_block_3
条件判断的使用原则: