print 'Adam: 95'
print 'Lisa: 85'
print 'Bart: 59'笑死了,这样也可以,哈哈哈哈哈
print 'Lisa: 85'
print 'Bart: 59'笑死了,这样也可以,哈哈哈哈哈
2018-08-19
def move(n,a,b,c):
if n==1:
print(a,'--',c)
elif n==2:
print(a,'--',b)
print(a,'--',c)
print(b,'--',c)
else:
move(n-1,a,c,b)
print(a, '--', c)
move(n-1,b,a,c)
move(4,'a','b','c')
if n==1:
print(a,'--',c)
elif n==2:
print(a,'--',b)
print(a,'--',c)
print(b,'--',c)
else:
move(n-1,a,c,b)
print(a, '--', c)
move(n-1,b,a,c)
move(4,'a','b','c')
2018-08-19
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for k, v in d.items():
sum = sum + v
print k,":",v
print 'average', ':', sum/len(d)
sum = 0.0
for k, v in d.items():
sum = sum + v
print k,":",v
print 'average', ':', sum/len(d)
2018-08-18
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
groupList = d.values()
sum = 0.0
for x in groupList:
sum += x
print sum/len(groupList)
groupList = d.values()
sum = 0.0
for x in groupList:
sum += x
print sum/len(groupList)
2018-08-18
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for index, name in zip(range(1,len(L)+1),L):
print index, '-', name
for index, name in zip(range(1,len(L)+1),L):
print index, '-', name
for x in range(1,11):
for y in range(1,10):
if x < y:
print str(x) + str(y)
for y in range(1,10):
if x < y:
print str(x) + str(y)
2018-08-18
sum = 0
x = -1
while True:
x = x + 2
if x > 100:
break
sum += x
print sum
x = -1
while True:
x = x + 2
if x > 100:
break
sum += x
print sum
2018-08-18
sum = 0
x = 1
n = 1
while True:
sum += x
x *= 2
n += 1
if n>20:
break
print sum
x = 1
n = 1
while True:
sum += x
x *= 2
n += 1
if n>20:
break
print sum
2018-08-18
sum = 0
x = 1
while x <100:
sum += x
x += 2
print sum
x = 1
while x <100:
sum += x
x += 2
print sum
2018-08-18
L = [75, 92, 59, 68]
sum = 0.0
for score in L :
sum += score
print sum / 4
sum = 0.0
for score in L :
sum += score
print sum / 4
2018-08-18
score = 55
if not score < 60:
print 'passed'
else:
print 'failed'
if not score < 60:
print 'passed'
else:
print 'failed'
2018-08-18