sum = 0
x = 1
while x<=100:
if x%2!=0:
sum = x + x
x = x + 1
print sum
x = 1
while x<=100:
if x%2!=0:
sum = x + x
x = x + 1
print sum
2018-07-13
for x in [ 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:
continue
print (10*x+y)
for y in [ 0,1,2,3,4,5,6,7,8,9 ]:
if x>=y:
continue
print (10*x+y)
2018-07-12
print'hello,python.'
print'hello,''python.'
print'hello,''python.'
2018-07-12
for x in range(10,100):
a=x/10%10
b=x%10
if(a<b):
print x
两个循环顿时把握看蒙了。。。。。
a=x/10%10
b=x%10
if(a<b):
print x
两个循环顿时把握看蒙了。。。。。
2018-07-12
print [x*100+y*10+z for x in range(1,10) for y in range(0,10) for z in range(1,10) if x==z ]
2018-07-11
L = ['Adam', 'Lisa', 'Paul', 'Bart']
L.pop(3)
L.pop(2)
print L
L.pop(3)
L.pop(2)
print L
2018-07-11
我觉得应该是删除了一个元素之后list的容量就变小了,下标最大值也变化了。变成了三个元素,下标最多也就是2.没有3吧
2018-07-11
print [int(str(i)+str(j)+str(k)) for i in range(1,10) for j in range(0,10) for k in range(0,10) if i==k]
2018-07-10