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 :)

23rd Oct 2021, 7:56 AM
Beginner
5 Respuestas
+ 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!
23rd Oct 2021, 8:35 AM
Kamil Hamid
Kamil Hamid - avatar
+ 3
Barnik Roy, that does not solve the problem, but does make for a better code (thank you)
23rd Oct 2021, 8:37 AM
Kamil Hamid
Kamil Hamid - avatar
+ 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
23rd Oct 2021, 8:36 AM
Kamil Hamid
Kamil Hamid - avatar
+ 2
Thank you for your advice :) I'm not that comfortable with SoloLearn yet, therefore thanks for your help!
23rd Oct 2021, 9:06 AM
Beginner