ctw6av
(usa Nenhuma)
Enviado em 28/12/2016 - 13:51h
Levando em conta os músculos e ossos um pouco mais pesados dos homens, ficaria +- assim:
Rascunho;
#!/usr/bin/env python3
class IMC(object):
def __init__(self):
self.weight = None
self.height = None
def calc(self):
result = float('{:.1f}'.format(self.weight / (self.height ** 2)))
if result < 16.0:
return str(result) + ' Magreza grave'
elif 16.0 + 1.0 > result > 16.0:
return str(result) + ' Magreza moderada'
elif 17.0 + 1.5 > result > 17.0:
return str(result) + ' Magreza leve'
elif 18.5 + 6.5 > result > 18.5:
return str(result) + ' saudável'
elif 25.0 + 5.0 > result > 25.0:
return str(result) + ' Sobrepeso'
elif 30.0 + 5.0 > result > 30.0:
return str(result) + ' Obesidade Grau I'
elif 35.0 + 5.0 > result > 35.0:
return str(result) + ' Obesidade Grau II (severa)'
elif self.calc() > 40.0:
return str(result) + ' Obesidade Grau III (mórbida)'
class Man(IMC):
def __init__(self, weight, height):
super().__init__()
self.weight = weight - 1
self.height = height
def imc(self):
print(self.calc())
class Woman(IMC):
def __init__(self, weight, height):
super().__init__()
self.weight = weight
self.height = height
def imc(self):
print(self.calc())
if __name__ == '__main__':
woman = Woman(weight=62, height=1.62)
woman.imc()
man = Man(weight=62, height=1.62)
man.imc()
______________________________________________________________________
OS: Biebian
Kernel: x86_64 3.5.2-amd64
Resolution: 1320x768
CPU: Intel Core i3-4005U CPU @ 1.7GHz
RAM: 3852MiB
Distro:
http://biebian.sourceforge.net/