1 def normalize(name): name.capitalize()
2def prod(L): def mul(a,b) return a*b
reduce(mul,L)
3def str2float(s): def char2num(s) return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '.':'.'}[s]
def ff(a,b) return 10*a+b index = '.' in s return reduce(ff,map(char2num,s))/(10**(s.length()-index-1))
char2num 的 '.':'.' 去掉即可
北鼻,第一个记得加return哦~
Sign in to make a reply
假阳光真宅男
1 def normalize(name): name.capitalize()
2
def prod(L):
def mul(a,b) return a*b
3
def str2float(s): def char2num(s) return {'0': 0, '1': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '.':'.'}[s]