Skip to content

Instantly share code, notes, and snippets.

@pharshal
Created May 8, 2015 08:31
Show Gist options
  • Save pharshal/7a84876a214855497a0b to your computer and use it in GitHub Desktop.
Save pharshal/7a84876a214855497a0b to your computer and use it in GitHub Desktop.
def sum(list):
if(len(list) == 0):
return
if(len(list) == 1):
return list[0]
return sum(list[:-1]) + list[-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment