Discuss / Python / 答案

答案

Topic source

lmtooT_T

#1 Created at ... [Delete] [Delete and Lock User]

1、

return name[0].upper()+name[1:].lower()

2、

return reduce(lambda x,y:x*y,L)

3、

index = s.index('.')
def p(x, y):
    return x * 10 + y
def d(x, y):
    return x * 0.1 + y
def char2num(s):
    return int(s)
return reduce(p, map(char2num, s[:index])) + reduce(d, map(char2num, s[index + 1:][::-1])) * 0.1

lmtooT_T

#2 Created at ... [Delete] [Delete and Lock User]

3、

return reduce(p, map(char2num, s[:index])) + reduce(d,  map(char2num, s[:index:-1])) * 0.1

  • 1

Reply