My bmi calculator is ok but why this app not accepting my test of bmi calculator? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

My bmi calculator is ok but why this app not accepting my test of bmi calculator?

15th Feb 2021, 8:10 AM
Aryan King
Aryan King - avatar
11 Answers
+ 4
# Mistakes # 1. weight = float(input()) # 2. BMI = weight / height**2 # 3. No mistake found 😂 # Correction # Try this code out weight = float(input()) height = float(input()) bmi = weight / (height ** 2) if bmi < 18.5: print('Underweight') elif bmi >= 18.5 and bmi < 25: print('Normal') elif bmi >= 25 and bmi < 30: print('Overweight') elif bmi >= 30: print('Obesity')
15th Feb 2021, 9:00 AM
∆BH∆Y
∆BH∆Y - avatar
+ 4
The new end of module challenges look for exact outputs so don't have any unspecified prints (outputs).
15th Feb 2021, 10:37 AM
Sonic
Sonic - avatar
+ 4
We're usually advised not to post exact solutions.
16th Feb 2021, 6:29 AM
Sonic
Sonic - avatar
+ 3
Please post your try / code here!! So that I can find mistakes for you to figure out
15th Feb 2021, 8:48 AM
∆BH∆Y
∆BH∆Y - avatar
+ 3
weight=int(input()) height=float(input()) BMI=weight/height**2 print(BMI) if BMI<18.5: print ('Underweight') elif BMI >=18.5 and BMI<25: print('Normal') elif BMI>=25 and BMI<30: print('Overweight') elif BMI>=30: print('Obesity')
15th Feb 2021, 8:54 AM
Aryan King
Aryan King - avatar
+ 2
This plz
15th Feb 2021, 8:54 AM
Aryan King
Aryan King - avatar
+ 2
Remember, Python is a case sensitive language
15th Feb 2021, 9:49 AM
∆BH∆Y
∆BH∆Y - avatar
+ 2
I think the error was that you were printing the BMI value.
15th Feb 2021, 10:36 AM
Sonic
Sonic - avatar
+ 1
What is mistake in my code?
15th Feb 2021, 9:25 AM
Aryan King
Aryan King - avatar
+ 1
My code's only mistake is that BMI is in capital whereas they aceppt it as bmi🙄🙄😡
15th Feb 2021, 9:29 AM
Aryan King
Aryan King - avatar
+ 1
bmi = float(input())/float(input())**2 if bmi<18.5:print('Underweight') elif 25>bmi>=18.5:print('Normal') elif 30>bmi>=25:print('OverWeight') elif bmi>=30:print('Obesity')
21st Feb 2021, 5:01 PM
RXRX
RXRX - avatar