Question: Must be in Python 3 Address the FIXME comments. Move the respective code from the while-loop to the created function. The add_grade function has already
Must be in Python 3 Address the FIXME comments. Move the respective code from the while-loop to the created function. The add_grade function has already been created.
# FIXME: Create add_grade function def add_grade(student_grades): print('Entering grade. ') name, grade = input(grade_prompt).split() student_grades[name] = grade
# FIXME: Create delete_name function
# FIXME: Create print_grades function
student_grades = {} # Create an empty dict grade_prompt = "Enter name and grade (Ex. 'Bob A+'): " delete_prompt = "Enter name to delete: " menu_prompt = ("1. Add/modify student grade " "2. Delete student grade " "3. Print student grades " "4. Quit ")
command = input(menu_prompt).lower().strip()
while command != '4': # Exit when user enters '4' if command == '1': add_grade(student_grades) elif command == '2': # FIXME: Only call delete_name() here print('Deleting grade. ') name = input(delete_prompt) del student_grades[name] elif command == '3': # FIXME: Only call print_grades() here print('Printing grades. ') for name, grade in student_grades.items(): print(name, 'has a', grade) else: print('Unrecognized command. ')
command = input().lower().strip()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
