条件句
if, if-else, if-elif-else
循环语句
while ,for
简单例子如下:
1 n = 9 2 3 if n<4: 4 print("if当前数字为:",n) 5 elif n>8: 6 print("当前值为",n) 7 8 9 while n<4: 10 print("while当前数字为",n) 11 n+=1 12 else: 13 print("ggggg") 14 15 for i in range(10): 16 print("for循环:",i) 17 if i<n: 18 continue 19 else: 20 print("for输出数字为:",i)
原文地址:https://www.cnblogs.com/qianlanseleiguang/p/11523479.html
时间: 2024-11-08 16:08:25