#while 布林值:
#若布林值為true鲸鹦,執(zhí)行命令
#回到上方,做下一個(gè)的循環(huán)判斷
n = 1
sum = 0
while n <=10:
print("n =",n)
sum = sum +n
n+=1
print(sum)
for loop
#for 變量 in 列表或者字符串:
#列表或者字符中的變量逐一取出肌幽,逐一處理
for x in [4,1,2]:
print(x)
for c in "hello":
print(c)
#range() 連續(xù)數(shù)字的列表
#range(3) = [0,1,2]
#range(5) = [0,1,2,3,4]
#range(3,6)= [3,4,5]
# for x in range(4):
#print(x)
sum = 0
for x in range(11):
sum = sum+x
print(sum)