1.最简单的用户交互
2.条件判断
# ======第一种======
if 条件:
todo代码
# ======第二种======
if 条件:
todo代码
else:
todo代码
# =====第三种====
if 条件:
if 条件:
todo代码
else:
todo代码
else:
todo代码
# =====第四种=====
if 条件:
todo代码
elif 条件:
todo代码
else:
todo代码
3.循环语句 while
1.语法
while 条件:
todo代码
2.break和continue
break:
continue:
4.for循环
for 变量 in 可迭代的东西:
todo代码
把可迭代的东西中的每一项内容拿出来,挨个赋值给变量,每一次赋值都要执行一次循环体代码
5.pass:代码占位