Write a Hmmm programHarvey Mudd Miniature Machine averageha
Write a Hmmm program(Harvey Mudd Miniature Machine), average.ha, that repeatedly prompts for and reads in a sequence of integers and prints their average (rounded down, since we are dealing with integers) and prints the remainder (possibly 0). To mark the end of your sequence, enter 0. This last 0 should not be counted in the average (ie don\'t count it as an entry). Eg
Note: if just a 0 is entered, nothing should be printed.
Please use comments to provide a short narrative at the start of each program.
MUST BE IN HMMM***
Solution
inp = \'Enter a number: \' total = 0 count = 0 average = 0 while True: s = raw_input(inp) if s == \'done\': break try: total += float(s) count += 1 average = total / count except ValueError: print \"Invalid Input. Try again: \" continue print \'You entered %s numbers whose total is %s and average is %s.\' % (str(count), str(total), str(average))