Question: 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
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
