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

BMI Calculator

Could You tell me what I have done wrong and help me solve this task correctly, please? #your code goes here weight = int(input()) height = float(input()) bodyMassIndex = print(float(weight/(height*height))) if bodyMassIndex < 18.5: print ("Underweight") elif 18.5 <= bodyMassIndex < 25: print ("Normal") elif 25 <= bodyMassIndex < 30: print ("Overweight") else: print ("Obesity")

13th Jun 2021, 11:09 AM
Dariusz Jenek
Dariusz Jenek - avatar
5 Answers
+ 9
bodyMassIndex = float(weight/(height*height))
13th Jun 2021, 11:15 AM
Simba
Simba - avatar
+ 2
Jonathan P. Jundarino no need of indentation as blocks are inlined and with only one statement ;)
13th Jun 2021, 11:20 AM
visph
visph - avatar
0
bodyMassIndex = print(float(weight/(height*height))) why here the need of print function? Just use bodyMassIndex = float(weight/(height*height)) if any error still, then check spelling of output statements once..
13th Jun 2021, 11:18 AM
Jayakrishna 🇮🇳
0
visph Ahh, okay thanks, I will soon take python to remember
13th Jun 2021, 11:21 AM
Jonathan P. Jundarino
Jonathan P. Jundarino - avatar
0
#your code goes here Height = int(input()) Weight = float(input()) BMI = (Weight)/(Height) **2 if BMI <18.5: print('Underweight') elif BMI >= 18.5 < 25: print('Normal') elif BMI >= 25 < 30: print('overweight') else: print('Obesity') Please what is wrong with my code
26th Feb 2022, 6:08 AM
Chukwuka Francisca Makuochukwu
Chukwuka Francisca Makuochukwu - avatar