Question: ########################################################## # CORRECT THE CODE PROBLEMS IN THE PROVIDED CODE Answers/output values should be: student1: 82.50 student2: 90.00 student3: 70.00 Class average: 80.83 # REMEMBER

########################################################## # CORRECT THE CODE PROBLEMS IN THE PROVIDED CODE

Answers/output values should be:

student1: 82.50

student2: 90.00

student3: 70.00

Class average: 80.83

# REMEMBER TO LEAVE YOUR DEBUG STATEMENT(S) IN THE CODE!

##########################################################

""" Purpose: 1. Calculate & print the average grade for each student 2. Calculate & print the average grade for the class (3 students) """

student_grades = { "student1": [80, 81, 82, 83, 84, 85], "student2": [85, 85, 95, 95, 90, 90], "student3": [75, 65, 75, 65, 75, 65] }

student_count = 0 student_total = 0 student_avg = 0

class_total = 0 class_avg = 0

for student, grades in student_grades.items(): for grade in grades: student_total = grade # Calculate student average student_avg = student_total / len(grades) # Display each student's name and average print(f'{student}: {student_avg:.2f}') student_count += 1

# Add student avg to class total class_total += student_avg

# Calculate class average class_avg = class_total / student_count

# Display class average print(f'Class average: {class_avg:.2f}')

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 Databases Questions!