Bootstrap

Python学习笔记-循环for&while

for

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

# 打印数字 0 - 9
for x in range(10):
    print(x)
#计算1+2+3...+100
sum = 0
for x in range(101):
    sum = sum + x
print(
;