Skip to content

Instantly share code, notes, and snippets.

@vierbergenlars
Created May 25, 2013 12:56
Show Gist options
  • Save vierbergenlars/5648962 to your computer and use it in GitHub Desktop.
Save vierbergenlars/5648962 to your computer and use it in GitHub Desktop.
def count(lst, elem):
if len(lst) == 1:
return lst[0] == elem
else:
return count(lst[1:], elem) + (lst[0] == elem)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment