using datalass
from dataclasses import dataclass from decimal import Decimal @dataclass class BMI: height: int weight: int @property def bmi(self): return self.weight / (self.height ** 2) def calculate_bmi(self): return "there is no excess weight" if self.bmi < 25 else "there is excess weight"
class BMI:def __init__(self, height, weight):self.height = heightself.weight = weight- from dataclasses import dataclass
- from decimal import Decimal
- @dataclass
- class BMI:
- height: int
- weight: int
- @property
- def bmi(self):
- return self.weight / (self.height ** 2)
- def calculate_bmi(self):
- return "there is no excess weight" if self.bmi < 25 else "there is excess weight"