Search⌘ K

Solution Review 2: Calculate the Student's Performance

Understand how to create Python classes with public properties for student marks, implement methods to calculate total obtained marks, and compute percentage scores to evaluate student performance.

We'll cover the following...

Solution #

Python 3.5
class Student:
def __init__(self, name, phy, chem, bio):
self.name = name
self.phy = phy
self.chem = chem
self.bio = bio
def totalObtained(self):
return(self.phy + self.chem + self.bio)
def percentage(self):
return((self.totalObtained() / 300) * 100)

Explanation

  • In line 3 - 6, we have initialized name, phy ...