#!/usr/local/bin/python3 class Person: def __init__(self, weight, height): self.weight = weight self.height = height class BMI: def __init__(self, person): self.person = person h = person.height / 100 self.bmi = person.weight / (h**2) def decide(self): print('---') print('BMI =', self.bmi) if self.bmi < 18.5: print('痩せ型') elif self.bmi < 25.0: print('標準') elif self.bmi < 30.0: print('軽度肥満') elif self.bmi < 35.0: print('重症肥満') else: print('超肥満') person = Person(65, 170) print(person) bmi = BMI(person) print(bmi) bmi.decide