Discuss / Python / 第一题

第一题

Topic source

丿疯子乄

#1 Created at ... [Delete] [Delete and Lock User]
def resetnames(names):
    def highFirstCh(name):
        return name[0:1].upper() + reduce(lambda x, y : x + y, map(lambda ch : ch.lower(), name[1:]))

    return map(highFirstCh, names)

print(resetnames(['adam', 'LISA', 'barT', 'JACK']))

  • 1

Reply