Question: def add _ grade ( student _ grades ) : print ( ' Entering grade. ' ) name, grade = input ( grade _ prompt

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(f'{name} has a {grade}.')
else:
print('Unrecognized command.
')
command = input().lower().strip()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!