Programming Exercise 13

  < Previous  Next >

Due Date

See the calendar for due date.

Assignment:

The Fork Spring Golf Club has a completed their tournaments and now the club president asked you to write another program. This program will read the previously written scores from a file and then determine the winning player and score (lowest score wins). The program should contain a main() function which prompts the user for the input file name. This program will then call the function scored(inFile) where inFile is the file object. The scored() function should then read through the player data to find the winner and their score. This data should then be printed to standard output. The function should return the average score to main() which will be printed to standard output. The main() function should close the input file.

Sample Input File

Examples

The following are examples of correct execution (with the text in bold being the input from the user):
Please enter the name of file for processing: golf.txt

The winner of the tournament is Marie with a score of 21!
The average for the tournament is 32.0
Please enter the name of file for processing: golfB.txt

The winner of the tournament is Mary with a score of 76!
The average for the tournament is 88.0

Submission

Submit your python script using the handin program. For handin, for this lab, type the following in a terminal window exactly as it appears:
handin  pe13  pe13.py
To verify your submission, type the following in a terminal window:
handin  pe13

Note

You can get a sample input file, golf.txt, by typing one of the following into a terminal on ranger:
  1. cp ~hcarroll/public_html/1170/private/closedLabs/golf.txt golf.txt
  2. wget https://cs.mtsu.edu/~hcarroll/1170/private/closedLabs/golf.txt
To verify the file downloaded or copied correctly, type ls -l golf.txt.