Created
January 22, 2013 21:27
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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