python编写函数,模拟内置函数sum()

def Sum(iterable, start=0):
    result = start
    for item in iterable:
        result = result + item
    return result

print(Sum([1,2,3,4,5]))

你可能感兴趣的:(python,python)