MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / average_grade

Method average_grade

example_code/item_029.py:187–192  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

185 self._grades.append(Grade(score, weight))
186
187 def average_grade(self):
188 total, total_weight = 0, 0
189 for grade in self._grades:
190 total += grade.score * grade.weight
191 total_weight += grade.weight
192 return total / total_weight
193
194
195print("Example 11")

Callers 2

item_029.pyFile · 0.45
average_gradeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected