第一题
def normalize(name): return name.lower().capitalize()
第二题
def prod(L): return reduce(lambda x, y: x * y, L)
第三题
def str2float(s): return reduce(lambda x, y: x * 10 + y, map(int, s.replace(".", ""))) / (10 ** s.find("."))
第三题写错了- -WTF
def str2float(s): return reduce(lambda x, y: x * 10 + y, map(int, s.replace(".", ""))) / (10 ** (len(s) - s.find(".") - 1))
第一题我尝试了下直接使用name.capitalize()就已经可以做到了
靠这样看来我也写反了
Sign in to make a reply
ForkPanda
第一题
第二题
第三题