标签:问题 lis 缩进 就会 通过 执行 sam 依次 不执行
自我学习记录:如有问题,请帮助指正,勿喷。print(1+2+3+4)
names=(‘Sam‘,‘Max‘,‘Leo‘)
for name in names:
print(name)
sum = 0
for x in (1,2,3,4,5,6,7,8,9,10):
sum =sum + x
print(sum)
print(list(range(100)))
sum = 0
n = 99
while n > 0:
sum = sum +n
n = n - 2
print(sum)
sum = 0
n = 99
while n > 0:
break
sum = sum +n
n = n - 2
print(sum,‘break 跳出当前循环‘)
sum = 2
n = 99
s = 100
while n > 0:
sum = sum +n
n = n - 2
continue
s = 0
print(‘%d %d %d‘%(sum,s,n))
n = 0
sum = 0
res = 0
while (n <=50):
res = (res+ n )
n = n + 1
print(res)
n=60
while (n<=100):
sum = (sum + n)
n = n + 1
sum=sum+res
print(sum)
n = 0
sum =0
res = 0
while n<=100:
sum = (sum +n)
n = n + 1
print(sum)
print(n)
n = 51
while n >50 and n <60:
res = (res + n)
n = n + 1
print(res)
print(sum - res)
n=0
sum=0
res=0
while n<=100:
if n <= 50:
res=(res + n)
n=n+1
elif (n>50 and n<60) :
n=n+1
continue
else :
sum=sum+n
n=n+1
print(res)
print(sum+res)
**
标签:问题 lis 缩进 就会 通过 执行 sam 依次 不执行
原文地址:https://blog.51cto.com/13184683/2440121