+ 3

simple BMI calculator making by Python

I'm new here. I'm trying to learn python as well.so trying to harder I made a BMI calculator just simple.need your comment how was this?is it right or wrong? is possible to make this code also easier? weight = float(input()) height = float(input()) BMI = weight / (height ** 2) if BMI < 18.5: print("Underweight") elif 18.5 <= BMI < 25: print("Normal") elif 25 <= BMI < 30: print("Overweight") else: print("Obesity") print("Finished")

25th Feb 2021, 8:48 AM
Md Abdur Rahman
Md Abdur Rahman - avatar
3 odpowiedzi
+ 6
Md Abdur Rahman Q: "Is it right or wrong?" Have you tried it on the challenge itself? If it passed all the test cases then it's fine, if not, then the community will help. Though I think that won't pass all test cases because of the last line that prints "Finished" which is not needed.
25th Feb 2021, 9:07 AM
noteve
noteve - avatar
+ 3
Hi! you tried running this code in the "codes" section { }? where did you get it?
25th Feb 2021, 8:53 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Hi! Nice codes you have written but the weight should be an integer not a float and you can do without the last statement.
5th Jun 2021, 4:01 PM
Wasiu Ajibola Jolaosho
Wasiu Ajibola Jolaosho - avatar