Discuss / Python / 我的答案

我的答案

Topic source

虫虫Aaron

#1 Created at ... [Delete] [Delete and Lock User]
第一题
    return name[:1].upper()+name[1:].lower()

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

第三题
    l = s.split('.')
    def fn(x, y):
        return x * 10 + y
    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]
    return reduce(fn, map(char2num, l[0]))+reduce(fn, map(char2num, l[1]))/pow(10,len(l[1]))

  • 1

Reply