for x in range(1, 10):
for y in range(x+1, 10):
print x*10+y
for y in range(x+1, 10):
print x*10+y
2016-01-17
sum = 0
x = 1
n = 1
while True:
sum, x, n=sum+x, x*2, n+1
if n>20:
break
print sum
x = 1
n = 1
while True:
sum, x, n=sum+x, x*2, n+1
if n>20:
break
print sum
2016-01-17
sum = 0
x = 1
while x<=100:
sum, x=sum+x,x+2
print sum
x = 1
while x<=100:
sum, x=sum+x,x+2
print sum
2016-01-17
sum = 0
x = 1
n = 1
while True:
sum = sum + x
x = x * 2
n = n + 1
if n > 20:
break
print sum
x = 1
n = 1
while True:
sum = sum + x
x = x * 2
n = n + 1
if n > 20:
break
print sum
2016-01-17
L = [95.5,85,59]
print L[0]
print L[1]
print L[2]
print L[-1]
print L[0]
print L[1]
print L[2]
print L[-1]
2016-01-17
L = ['Adam',95.5,'Lisa',85,'Bart',59]
print L
我还help了半天的sort 结果。。。
print L
我还help了半天的sort 结果。。。
2016-01-17
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
for key in d:
print key,':',d[key]
2016-01-17
d = {
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'adam:', d['Adam']
print 'lisa:', d['Lisa']
print 'bart:', d['Bart']
'Adam': 95,
'Lisa': 85,
'Bart': 59
}
print 'adam:', d['Adam']
print 'lisa:', d['Lisa']
print 'bart:', d['Bart']
2016-01-17
for x in [ 1,2,3,4,5,6,7,8,9 ]:
for y in [ 2,3,4,5,6,7,8,9 ]:
if x<y:
print x*10+y
for y in [ 2,3,4,5,6,7,8,9 ]:
if x<y:
print x*10+y
2016-01-17