条件判断 和 循环

96
石头007
2016.06.19 07:55* 字数 89

判断
if <条件判断1>:
<执行1>
elif <条件判断2>:
<执行2>
elif <条件判断3>:
<执行3>
else:
<执行4>

循环

for in 循环

names = ['Michael', 'Bob', 'Tracy']
for name in names:
print(name)

while 循环

sum = 0
n = 99
while n > 0:
sum = sum + n
n = n - 2
print(sum)

python学习笔记
Web note ad 1