练习1
def normalize(name): return name.capitalize()
练习2
def prod(L): pass def mul(x, y): return x * y return reduce(mul ,L)
练习3
def str2float(s): def char2num(c): return {'0' : 0, '1' : 1, '2' : 2, '3' : 3, '4' : 4, '5' : 5, '6' : 6, '7' : 7, '8' : 8, '9' : 9}[c] def num2float(x, y): return x * 10 + y l = s.split('.') l1 = reduce(num2float, list(map(char2num, l[0]))) l2 = reduce(num2float, list(map(char2num, l[1])))/10**len(l[1]) return l1 + l2
Sign in to make a reply
温布利不坑爹
练习1
练习2
练习3