class BMI:
def __init__(self, weight, height):
self.weight = weight
self.height = height / 100
self.total = 0
def calculate(self):
self.total = self.weight / (self.height ** 2)
return self.total
def bmical(self):
if self.total < 18.5:
print("저체중")
elif self.total < 23:
print("정상")
elif self.total < 25:
print("과체중")
else:
print("비만")
bmi = BMI(70, 180)
bmi.calculate()
bmi.bmical()
To embed this project on your website, copy the following code and paste it into your website's HTML: