Skip to content

Instantly share code, notes, and snippets.

@johnwcothran
Last active February 20, 2018 21:08
Show Gist options
  • Save johnwcothran/a2087789148845c455e139f06d71d011 to your computer and use it in GitHub Desktop.
Save johnwcothran/a2087789148845c455e139f06d71d011 to your computer and use it in GitHub Desktop.
def mean(arr):
return sum(arr) / len(arr)
# New code:
def isEven (arr):
return arr % 2 == 0
def half (arr):
if isEven(len(arr)):
return int(len(arr)/2) - 1
else:
return int(len(arr)/2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment