Загрузка…
Python · junior · сложность 2
class Rectangle: def __init__(self, width: float, height: float) -> None: self.width = width self.height = height def area(self) -> float: return self.width * self.height def perimeter(self) -> float: return 2 * (self.width + self.height)
Суммируя:
Короче: – Методы могут вычислять значения на основе атрибутов экземпляра.