Programming problem: Speed Reading: Average numbers from an input file
This problem requires you to combine the ideas of exception handling, defining functions, reading from files, and using a graphics window to get user input.
Your task is to read numbers from a file and calculate the mean of the numbers. Unfortunately, the file is a bit malformed. The numbers are generated by a radar gun that measures the speed of each vehicle on the road coming up the hill from the SRC. Due to an intermittent open circuit occasionally multiple numbers are written on a single line, like this:
23.2 15.6 19.8
Occasionally the radar gun also puts a
single
stray character at the end of a number, like
17.9a
instead of
17.9, or
24.9$
instead of
24.9. A sample input file is available here:
speeds.txt.
setText() method to change the displayed value of a string that has already been drawn.
Submit your program by uploading your fileAverages.py file to the fileAverages drop box in the Homework 10 folder on ANGEL.