Skip to content

Instantly share code, notes, and snippets.

@jsundram
Created January 22, 2013 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsundram/4598587 to your computer and use it in GitHub Desktop.
Save jsundram/4598587 to your computer and use it in GitHub Desktop.
Input a number at a time, and find out the running mean and median.
import numpy
def running():
numbers = []
while True:
try:
i = input("Enter Number: ")
numbers.append(i)
print "Current median: %s" % (numpy.median(numbers))
print "Current average: %s" % (numpy.average(numbers))
except SyntaxError:
print "data:"
print numbers
break
if __name__ == '__main__':
running()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment