"""##################################################
#Test 1:
def normalize(name): strName = name[0].upper()+ name[1:].lower() return strName
def normalize1(name): #字符串重新赋值,并不是操作tuple or list的队列直接相加 result = None for i in range(len(name)): if i == 0: result = name[i].upper() else: result = result+name[i].lower() return result
#Test 2: from functools import reduce
def multiplication(a,b): return a*b
def prod(L): return reduce(lambda a,b: a*b,L)
#Test 3: from functools import reduce NUM = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
def str2float(s): sL = s.split(".") if len(sL) == 2: intNum = sL[0] floatNum = sL[1] else: print("Type the wrong numbers") return None #整数部分的累积 high = reduce(lambda x,y:x*10+y, map(lambda numStr :NUM[numStr],intNum))
#小数部分的累积 low = reduce(lambda x,y:x0.1+y, map(lambda numStr :NUM[numStr],reversed(floatNum)))0.1 result = high+low return result """##################################################
Sign in to make a reply
反手圣光剑同学_吉毛
"""##################################################
#Test 1:
def normalize(name): strName = name[0].upper()+ name[1:].lower() return strName
def normalize1(name): #字符串重新赋值,并不是操作tuple or list的队列直接相加 result = None for i in range(len(name)): if i == 0: result = name[i].upper() else: result = result+name[i].lower() return result
"""##################################################
#Test 2: from functools import reduce
def multiplication(a,b): return a*b
def prod(L): return reduce(lambda a,b: a*b,L)
"""##################################################
#Test 3: from functools import reduce NUM = {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9}
def str2float(s): sL = s.split(".") if len(sL) == 2: intNum = sL[0] floatNum = sL[1] else: print("Type the wrong numbers") return None #整数部分的累积 high = reduce(lambda x,y:x*10+y, map(lambda numStr :NUM[numStr],intNum))
#小数部分的累积 low = reduce(lambda x,y:x0.1+y, map(lambda numStr :NUM[numStr],reversed(floatNum)))0.1 result = high+low return result """##################################################