Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python please! 2 9 . 1 7 LAB: Count probations Students are put on probation if their GPA is below 2 . 0 . Complete
Python please! LAB: Count probations
Students are put on probation if their GPA is below Complete the Course class by implementing the countprobation instance method, which returns the number of students with a GPA below
The file main.py contains:
The main function for testing the program.
Class Course represents a course, which contains a list of Student objects as a course roster. Type your code in here.
Class Student represents a classroom student, which has three attributes: first name, last name, and GPA.
Hint: Refer to the Student class to explore the available instance methods that can be used for implementing the countprobation method.
Note: For testing purposes, different student values will be used.
Ex For the following students:
Henry Cabot
Brenda Stern
Lynda Robison
Jane Flynn
the output is:
Probation count:
class Student:
def initself first, last, gpa:
self.first first # first name
self.last last # last name
self.gpa gpa # grade point average
def getgpaself:
return self.gpa
def getlastself:
return self.last
class Course:
def initself:
self.roster # list of Student objects
def addstudentself student:
self.roster.appendstudent
def coursesizeself:
return lenselfroster
# Type your code here
if namemain:
course Course
course.addstudentStudentHenry 'Cabot',
course.addstudentStudentBrenda 'Stern',
course.addstudentStudentLynda 'Robison',
course.addstudentStudentJaneFlynn
probcount course.countprobation
printProbation count: probcount
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started