Question: Program: GradeBook.py Scenario: A high school teacher needs to track students' grades and calculate averages for reports. You are tasked to develop this system. Task:
Program:
GradeBook.py
Scenario:
A high school teacher needs to track students' grades and calculate averages for
reports. You are tasked to develop this system.
Task:
Write a Python class named GradeBook with the following components:
Fields:
grades list of floats: A list to hold grades
Constructors:
A constructor that initializes the grades with an empty list.
Methods:
addgradegrade : Adds a grade to the list. If the grade is not between
and raise a ValueError with the message "Invalid grade"
calculateaverage: Calculates and returns the average of the grades in
the list.
str: Returns a string that shows all grades and the average.
In the main method, create instances of GradeBook, add grades, calculate the average,
and handle any exceptions that arise.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
