单分支
if 条件: 满足条件后要执行的代码
if语句包含:
1. if 关键字
2.条件
3.冒号
4.在下一行开始,缩进的代码块
例如:
if name == 'kaixin': print('hello,kaixin.')
双分支 if 条件: 满足条件执行代码 else: if条件不满足就执行这段
else语句包含:
1. else 关键字;
2.冒号
3.在下一行,缩进的代码块
例如:
if name == 'kaixin': print('hello.') else: print('sorry.')
待补充~