Discuss / Python / normalize

normalize

Topic source

月渐殇

#1 Created at ... [Delete] [Delete and Lock User]

from functools import reduce

def normalize(name): return name.capitalize()

L1 = ['adam', 'LISA', 'barT'] L2 = list(map(normalize, L1)) print (L2)

月渐殇

#2 Created at ... [Delete] [Delete and Lock User]

-- coding: utf-8 --

from functools import reduce

def prod(L): return reduce(lambda x,y :x*y, L)

print('3 5 7 * 9 =', prod([3, 5, 7, 9]))


  • 1

Reply