Python variables

Dans python, il y a des types (int, float, str, bool), False, True, and, or, input.

J’ai écris un programme les utilisant pour calculer l’imc d’une personne:

poids=input("Quel est ton poids en kg? ")
poids=float(poids)
taille=input("Quel est ta taille en mètres? ")
taille=float(taille)

imc=poids/taille**2

print(imc)

if imc<18.5:
    print ("maigreur")   
if imc>40 :
    print("obésité massive")
    
else:
    if 24.9>imc and imc>18.5 :
        print ("normal")
    if 29.9>imc and imc>24.9 :
        print ("surpoid")
    if 40>imc and imc>29.9 :
        print ("obésité")

Aucune réponse

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *