Homework 11: Courses and Test Scores
Objective: To write a program to use a 2-D list to store test scores for multiple courses
Write a program that uses a 2-dimensional list (a list of lists) to store all the test scores in all of a student's classses. The program should work for any number of courses, with any number of tests for each course. It should then display the average test score for each course, and the highest average score. Here is some sample output:
[cpersiko@fog cs110a]$ python3 CourseAverages.py.txt
How many courses are you taking? 4
How many tests are in course number 1? 2
What was your score on test 1 for course 1? 85
What was your score on test 2 for course 1? 99
How many tests are in course number 2? 4
What was your score on test 1 for course 2? 75
What was your score on test 2 for course 2? 85
What was your score on test 3 for course 2? 90
What was your score on test 4 for course 2? 95
How many tests are in course number 3? 1
What was your score on test 1 for course 3? 88
How many tests are in course number 4? 3
What was your score on test 1 for course 4? 80
What was your score on test 2 for course 4? 88
What was your score on test 3 for course 4? 82
The average for course 1 is 92.00
The average for course 2 is 86.25
The average for course 3 is 88.00
The average for course 4 is 83.33
The highest average score is 92.00
[cpersiko@fog cs110a]$ python3 CourseAverages.py.txt
How many courses are you taking? 2
How many tests are in course number 1? 3
What was your score on test 1 for course 1? 70
What was your score on test 2 for course 1? 80
What was your score on test 3 for course 1? 90
How many tests are in course number 2? 4
What was your score on test 1 for course 2? 75
What was your score on test 2 for course 2? 80
What was your score on test 3 for course 2? 85
What was your score on test 4 for course 2? 90
The average for course 1 is 80.00
The average for course 2 is 82.50
The highest average score is 82.50
[cpersiko@fog cs110a]$
Hints and Rules
- Your program must use a list of lists (a 2-D list) to store all the scores in all the courses.
- Your program should have at least 2 functions, including a main() function (no global variables or global code other than a call to main within an if-statement)
- Every function (except main) needs to have a comment in a triple-quoted string at the beginning, briefly explaining what it does.
- As with every assignment, you must write all the code yourself. Do not copy any code other people have written. If you use any Python features we haven't covered in class then the graders will search the internet for that code, to make sure you didn't copy it from a web site.
- Make sure to put a comment at the top of your program with your name, the name of this assignment and class (110A Homework 11), and a brief description of what the program does.