Help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
2 Answers
+ 5
The first mistake you have made, is making the if statement in chained so the other if statement won't work if the first one is not fulfilled. Next, In this condition, you have written : if(weight / height**2 >= 18.5 and 25): similarly in the third condition. Here and 25 won't give you proper output. You have to rewrite the condition again, like that: if(weight / height**2 >= 18.5 and weight / height**2 <25): same rules goes on third condition. You can also use a chained statement if you don't want to rewrite it, like that: if(18.5>= weight / height**2<25): but the best will be to use an elif statement. Not mistake but you can declare the weight/height**2 inside a variable then you don't have to rewrite this line again and again. Here's an example: https://code.sololearn.com/cjffwplHGvwL
16th Aug 2021, 10:38 AM
The future is now thanks to science
The future is now thanks to science - avatar
+ 2
Thanks bro this helped me a lot . 😀😀
16th Aug 2021, 1:28 PM
Aakash Mitra
Aakash Mitra - avatar