mirror of
https://github.com/Faridik/Carolyn.git
synced 2026-07-08 13:21:53 +00:00
23 lines
591 B
Python
23 lines
591 B
Python
class Assignment(dict):
|
||
"""Задание."""
|
||
|
||
def __init__(self, name: str, points: list, weight: float = 1):
|
||
self.name = name
|
||
self.weight = weight
|
||
self.points = points
|
||
dict.__init__(
|
||
self,
|
||
name=self.name,
|
||
weight=self.weight,
|
||
points=self.points,
|
||
total=self.total,
|
||
)
|
||
|
||
@property
|
||
def total(self) -> float:
|
||
"""Получить общую оценку по заданию.
|
||
|
||
`вес*СУММ(рез-ты)`
|
||
"""
|
||
return sum(self.points) * self.weight
|