from functools import reduce
def normalize(name): b = a[0].upper() + a[1:].lower()
return b
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)
def prod(L):
def aa(x,y): return x*y return reduce(aa,L)
print('3 5 7 * 9 =', prod([3, 5, 7, 9]))
if prod([3, 5, 7, 9]) == 945: print('测试成功!') else: print('测试失败!')
Sign in to make a reply
纯情小男Yin
from functools import reduce
def normalize(name): b = a[0].upper() + a[1:].lower()
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)
def prod(L):
print('3 5 7 * 9 =', prod([3, 5, 7, 9]))
if prod([3, 5, 7, 9]) == 945: print('测试成功!') else: print('测试失败!')