第一题:
def normalize(name):
#除第一个字母全变小写
def add(x,y):
res = x+y
return res
def lower1(i):
res2 = i.lower()
return res2
info2 = reduce(add,map(lower1,name[1:]))
#把大写插入开头
upperword = name[0].upper()
info3 = upperword+info2
return info3
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)
第二题:
def prod(L):
def cheng(x,y):
res = x*y
return reduce(cheng,L)
第三题:
#第三题不会啊
flo = float(s)
return flo
Sign in to make a reply
Project71
第一题:
def normalize(name):
#除第一个字母全变小写
def add(x,y):
res = x+y
return res
def lower1(i):
res2 = i.lower()
return res2
info2 = reduce(add,map(lower1,name[1:]))
#把大写插入开头
upperword = name[0].upper()
info3 = upperword+info2
return info3
L1 = ['adam', 'LISA', 'barT']
L2 = list(map(normalize, L1))
print(L2)
第二题:
def prod(L):
def cheng(x,y):
res = x*y
return res
return reduce(cheng,L)
第三题:
#第三题不会啊
flo = float(s)
return flo