Skip to content

Instantly share code, notes, and snippets.

@zhuifengshen
Created November 22, 2018 08:00
Show Gist options
  • Save zhuifengshen/dc4be3427a353077df7b08bc34a1f9ea to your computer and use it in GitHub Desktop.
Save zhuifengshen/dc4be3427a353077df7b08bc34a1f9ea to your computer and use it in GitHub Desktop.
列表递归求和
def sum(lst):
if lst == []:
return 0
return lst[0] + sum(lst[1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment