单分支分支
使用`if`语句,根据一个条件表达式的真假来执行相应的代码块。
if condition:code to execute if condition is true
双分支分支
使用`if`和`else`语句,根据一个条件表达式的真假来执行不同的代码块。
if condition:code to execute if condition is trueelse:code to execute if condition is false

多分支分支
使用`if`、`elif`和`else`语句,可以添加多个条件分支,但只会执行一个满足条件的分支。
if condition1:code to execute if condition1 is trueelif condition2:code to execute if condition1 is false and condition2 is trueelse:code to execute if all conditions are false
巢状分支
在分支结构中嵌套另一个分支结构,用于处理更复杂的条件逻辑。
if condition1:if condition2:code to execute if both condition1 and condition2 are trueelse:code to execute if condition1 is true and condition2 is falseelse:code to execute if condition1 is false
这些分支结构允许程序根据不同的条件执行不同的代码路径,是编程中常见的控制结构之一
