>>>defmysum(l):
ifnotl:
return0
else:
print(l[0:])
returnl[0]+mysum(l[1:])#自身的调用


>>>mysum([1,2,3,4,5])
[1,2,3,4,5]
[2,3,4,5]
[3,4,5]
[4,5]
[5]
15