Semester average

To practice using while loops and lists, you will be creating a program that fills a list with courses the user is taking, and then empties that list while asking for, and totaling, the raw grade for each course. Finally, you'll average the raw grades, and tell the user the answer.

DO NOT use for loops when solving this lab.





Downloading a starter program

The first part of your program, which uses a use a while loop and input() statements to fill the list with courses, has been completed for you. You can download it using the following command:

       cp /afs/umbc.edu/users/k/k/k38/pub/cs201/given_semester.py semester.py

Notice that we are not using a "." (a period) at the end of the cp command. Instead, we are renaming the file from its original name of "given_semester.py" to "semester.py".

Complete the comment header block, filling in your name, section number, email, and the date.





Completing the file

This file is incomplete, and doesn't contain any loops yet. You will need to write both of the needed loops. The file also contains an outline (in comments) about what your program should look like.

You need to write the rest of the program, in which you ask the user for their raw grade in each course, "cross" that course off the list (by removing it), and print out their average grade once all of the raw grades have been entered.

You do not need to check that the grades are valid, and you may assume that the user will only enter integers (for the grades).





Sample output

Here is a sample run of the program, to give you an idea of what your program could look like. The exact text of the prompts may differ, but the order in which the information is asked for, and the eventual result printed out should be the same as the sample.

User input is shown in blue.

linux2[7]% scl enable python33 bash
bash-4.1$ python semester.py
What course did you take? ('NONE' to stop): CMSC 201
What course did you take? ('NONE' to stop): MATH 151
What course did you take? ('NONE' to stop): ENES 101
What course did you take? ('NONE' to stop): ENGL 100
What course did you take? ('NONE' to stop): NONE

What raw grade did you get in CMSC 201? 86
What raw grade did you get in MATH 151? 77
What raw grade did you get in ENES 101? 91
What raw grade did you get in ENGL 100? 95

In the 4 courses you took, you received a 87.25 as your average raw grade.

Remember to enable Python 3 before running your program!





If you get stuck, there are hints for a number of common problems under the "Additional Help" link in the left hand menu. Try to complete the program on your own before turning to these hints.