Discuss / Python / My version

My version

Topic source

第一题 def normalize(name): return name.capitalize()

第二题 def p(x,y): return x*y return reduce(p,L)

第三题 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 f(x, y): return x*10 + y def g(x, y): return x/10 + y s1,s2=s.split('.') s2=s2[::-1] print(s2) return reduce(f,map(char2num,s1))+reduce(g,map(char2num,s2))/10


  • 1

Reply