forked from tc1014-1613/Tarea_04
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIMC.py
41 lines (25 loc) · 829 Bytes
/
IMC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#encoding: utf-8
#autor: Allan Sánchez Iparrazar
#Indice de Masa Corporal
def calcularIMC(peso,estatura):
IMC = peso/(estatura*estatura)
return IMC
def determinarIMC(IMC):
if IMC < 18.5 :
tipoDePeso = "bajo peso"
elif IMC > 18.5 and IMC < 25 :
tipoDePeso = "peso normal"
elif IMC > 25 :
tipoDePeso = "sobrepeso"
return tipoDePeso
def main():
peso = float(input("Ingrese su peso en Kg"))
estatura = float(input("Ingrese su estatura en metros"))
if peso > 0 and estatura > 0 :
IMC = calcularIMC(peso,estatura)
tipoDePeso = determinarIMC(IMC)
print("Usted tiene",tipoDePeso)
print("Su peso es de %.2f"%IMC)
else :
print("### Error ###")
main()