from functools import reduce
def normalize(name): return name.lower().capitalize()
L1 = ['adam', 'LISA', 'barT'] L2 = list(map(normalize, L1)) print(L2)
def prod(L): def multiply(x,y): return x*y return reduce(multiply,L)
print('3 5 7 * 9 =', prod([3, 5, 7, 9]))
def str2float(s): def fn(x,y): return x10+y def char2num(n): return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}[n] list=s.split('.') list1=reduce(fn,map(char2num,list[0])) list2=reduce(fn,map(char2num,list[1])) return list1+list20.1**len(list[1])
print('str2float(\'123.456\') =', str2float('123.456'))
Sign in to make a reply
_Indescribable
from functools import reduce
def normalize(name): return name.lower().capitalize()
L1 = ['adam', 'LISA', 'barT'] L2 = list(map(normalize, L1)) print(L2)
def prod(L): def multiply(x,y): return x*y return reduce(multiply,L)
print('3 5 7 * 9 =', prod([3, 5, 7, 9]))
def str2float(s): def fn(x,y): return x10+y def char2num(n): return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}[n] list=s.split('.') list1=reduce(fn,map(char2num,list[0])) list2=reduce(fn,map(char2num,list[1])) return list1+list20.1**len(list[1])
print('str2float(\'123.456\') =', str2float('123.456'))