# -*- coding: utf-8 -*-
print r''' 静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
print r''' 静夜思
床前明月光,
疑是地上霜。
举头望明月,
低头思故乡。'''
2019-05-05
print [100*x+10*y+z for x in range(1,10) for y in range(0,10) for z in range(0,10) if z==x ]
2019-05-01
def toUppers(L):
return [x.upper() for x in L if isinstance(x,str)]
print toUppers(['Hello', 'world', 101])
return [x.upper() for x in L if isinstance(x,str)]
print toUppers(['Hello', 'world', 101])
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)
2019-05-01
d = { 'Adam': 95, 'Lisa': 85, 'Bart': 59, 'Paul': 74 }
sum = 0.0
for v in d.itervalues():
sum=sum+v
print sum/len(d)
sum = 0.0
for v in d.itervalues():
sum=sum+v
print sum/len(d)
2019-05-01
L = ['Adam', 'Lisa', 'Bart', 'Paul']
for index, name in zip(range(1,5),L):
print index, '-', name
for index, name in zip(range(1,5),L):
print index, '-', name