sum = 0
x = 0
while True:
x = x + 1
if x > 100:
break
else:
if x%2==0:
continue
sum =sum +x
print sum
x = 0
while True:
x = x + 1
if x > 100:
break
else:
if x%2==0:
continue
sum =sum +x
print sum
2019-01-08
sum = 0
n = 1
while True:
sum=sum+pow(2,n-1)
n=n+1
if n>20:
break
print sum
n = 1
while True:
sum=sum+pow(2,n-1)
n=n+1
if n>20:
break
print sum
2019-01-08
缩进到底啥规律???
sum = 0
x = 1
while x<100:
if(x%2) == 1:
sum = sum + x
x = x+1
print sum
sum = 0
x = 1
while x<100:
if(x%2) == 1:
sum = sum + x
x = x+1
print sum
2019-01-08
for x in [0,1,2,3,4,5,6,7,8,9 ]:
for y in [0,1,2,3,4,5,6,7,8,9 ]:
if x<y:
if x*10+y>10:
print x*10+y
这才是正确的吧
for y in [0,1,2,3,4,5,6,7,8,9 ]:
if x<y:
if x*10+y>10:
print x*10+y
这才是正确的吧
2019-01-08
print [int(x+y+x) for x in "123456789" for y in "0123456789"]
2019-01-08
n=zip(range(1,5),['Adam','Lisa','Bart','Paul'])
for index,name in n:
print index,'-',name
for index,name in n:
print index,'-',name
L = range(1, 101)
print L[:10]
print L[2::3]
print L[4:50:5]
print L[0:50][4::5]
print L[:10]
print L[2::3]
print L[4:50:5]
print L[0:50][4::5]
2019-01-08
sum = 0
x = 0
while True:
sum = sum + 2**x
x = x + 1
if x >= 20:
break
print sum
x = 0
while True:
sum = sum + 2**x
x = x + 1
if x >= 20:
break
print sum
2019-01-08