0
Hello, I've got a question about calculating the BMI. In the first print, I've got an error. An intended block would be intended
Does anyone have a clue what the mistake is? The code looks somehow like that: height = int(input ('your height in m') weight = int(input ()) if (height/weight**2<18.5): print("Underweight") if(height/weight**2>==18.5 and height/weight**2<25): print ("Normal") if... I would be very grateful if anyone could help me :)
4 Réponses
+ 3
That means that the print should be indented, as should everything after an if statement which should be executed if the condition is true. Like so:
height = int(input ('your height in m')
weight = int(input ())
if (height/weight**2<18.5):
print("Underweight")
if(height/weight**2>==18.5 and height/weight**2<25):
print ("Normal")
if...
To do the indents use the tab button on ur computer. Happy Coding!
+ 3
Barnik Roy, that does not solve the problem, but does make for a better code (thank you)
+ 2
Also, please search up this problem in discussions to see if this has come up in the future, as I have seen many posts like this
+ 2
Thank you for your advice :) I'm not that comfortable with SoloLearn yet, therefore thanks for your help!