Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite0
Guys can someone pls explain me what went wrong with this code?
The project (BMI calculator)In the course (python for beginners)shows wrong even though the inputs were provided.
5 Réponses
+ 1
In first elif statement after or
Put x <= 25
And in second one after or
Put x <= 30
+ 1
Give input dynamically i.e
weight=int(input())
height=float(input ())
x=weight/float(height**2)
Also you have to put 'AND' operator ,because you have to satisfy both conditions I.e
If x<18.5:
Print("Under weight")
elif x>=18.5 and x<25:
Print("Normal")
elif x>=25 and x<30:
Print("Over weight")
else:
Print("Obesity")
0
x=1.85**2/52
if x<18.5:
print("Under weight")
elif x>=18.5 or 25:
print("normal")
elif x>=25 or 30:
print("over weight")
else:
print("obesity")
0
Here is the code
0
Thanks guys