$30
ECE-203 Programming for Engineers
Homework Week 7
(50 Points) Write a program that keeps a dictionary in which both keys and values are strings – names
of students and their course grades. Your program should prompt the user with a menu consisting of the
following options:
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection:
If the user enters option 1, as shown below, the program shall behave as shown:
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection: 1
--Add Student--
Enter Name: Joe
Enter Grade: B+
Student Successfully Added!
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection:
1
If the user enters option 2, the program shall behave as follows if the name of an existing student is entered:
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection: 2
--Remove Student--
Enter Name: Joe
Successfully Removed ’Joe’!
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection:
...and if the name of a non-existent student is entered:
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection: 2
--Remove Student--
Enter Name: lakjsdflkjsdf
Student ’lakjsdflkjsdf’ Does Not Exist!
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection:
2
If the user enters option 3, the program shall behave as follows if the name of an existing student is entered:
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection: 3
--Modify Student Grade--
Enter Name: Joe
Enter Grade: C
Successfully Updated ’Joe’!
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection:
...and if the name of a non-existent student is entered:
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection: 3
--Modify Student Grade--
Enter Name: lkjlkjlkj
Student ’lkjlkjlkj’ Does Not Exist!
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection:
3
The display produced by option 4 should show each student’s name with their corresponding grade with the
following formatting:
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection: 4
--Displaying All Students--
Carl: B+
Joe: C
Sarah: A
Francine: A
Select an option:
[1] Add Student Grade
[2] Remove Student Grade
[3] Modify Student Grade
[4] Display All Student Grades
Enter selection:
The names need not be displayed in alphabetical order.
Name your program grades.py and save its output as grades.txt Be sure to show each of the 4 options
working correctly.
Submitting Your Assignment
Create a zip file with the following structure:
.HW7 abc123.zip
.grades.py
.grades.txt
name your zip file using your Drexel user id. For example: HW7 abc123.zip. Upload your zip file to
learn.drexel.edu using the assignment submission link found on the course website.
Points will be deducted for improperly packaged submissions.
4