26 Code_project : BMI Calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

26 Code_project : BMI Calculator

How to solve this challenge ?? I feel the problem is in the kg & meter.. if so how to convert ?? P.s : my code : W = int(input()) H = float(input()) res = int(W)/float(H**2) if res < 18.5 : print("Underweight") elif res >= 18.5 and res < 25 : print("Normal") elif res >= 25 and res <= 30 : print("Overweight") else : print("Obesity")

10th Mar 2022, 8:49 AM
Ahlam Khaled Ahmed
3 Answers
+ 3
Ahlam Ahmed , just a comment from me. since the code takes input with converting the values to int and float, we do not need to convert it again: ... #res = int(W)/float(H**2) res1 = W / H**2 # we can use this instead ... happy coding!
10th Mar 2022, 11:54 AM
Lothar
Lothar - avatar
+ 1
Sorry it did work, I guess the problem was I tried it on the website, when I did on the app it worked, Thank you 😊
10th Mar 2022, 10:45 AM
Ahlam Khaled Ahmed
0
It was a typo when i was writing the question,
10th Mar 2022, 10:16 AM
Ahlam Khaled Ahmed