自我学习记录:如有问题,请帮助指正,勿喷。
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)
**
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。