0

# BMI Calculator

Hello. Why after asuccessful test cases, task wasn't passed successfully? I may show screens of my program. It worked properly. My code weight=int(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 ("Owerweight") elif BMI > 30: print ("Obesity")

+9

Python the_height = float(input("Enter the height in cm: ")) the_weight = float(input("Enter the weight in kg: ")) # defining a function for BMI the_BMI = the_weight / (the_height/100)**2 # printing the BMI print("Your Body Mass Index is", the_BMI) # using the if-elif-else conditions if the_BMI <= 18.5: print("Oops! You are underweight.") elif the_BMI <= 24.9: print("Awesome! You are healthy.") elif the_BMI <= 29.9: the_print("Eee! You are over weight.") else: print("Seesh! You are obese.") java import java.util.Scanner; public class Example { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.print("Input weight in kilogram: "); double weight = sc.nextDouble(); System.out.print("\nInput height in meters: "); double height = sc.nextDouble(); double BMI = weight / (height * height); System.out.print("\nThe Body Mass Index (BMI) is " + BMI + " kg/m2"); } }

+3

print("Overweight")

+1

Людмила Камінська You are using BMI <= 18.5 and ... instead of BMI >= 18.5 .... in second if edit : spell check in "overweight"

+1

BMI calculator https://www.sololearn.com/Codes?ordering=MostRecent&query=BMI https://www.sololearn.com/Discuss?ordering=MostRecent&query=BMI

0

Can you share screens? edit: code added!

0

Screen by the link https://prnt.sc/26xsir9 Also, I can share code weight=int(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 ("Owerweight") elif BMI > 30: print ("Obesity")

0

Thank you very much for your help, I fixed but still doesn't pass test case 3 https://prnt.sc/26xt2dk

0

works !...

0

Your equality sign is wrong here,try to match from mine weight=int(input()) height=float(input()) bmi=weight/(height**2) if bmi < 18.5: print("Underweight") elif bmi < 25: print("Normal") elif bmi < 30: print("Overweight") else: print("Obesity")

0

At line 13 u wrote:-("Owerweight") And the write word us:-("Overweight ") If u write this so ur done will pass all tests!

0

#Operador // is the solution.. peso = float(input()) altura = float(input()) bmi = peso // altura**2 if bmi < 18.5: print ("Underweight") elif (bmi == 18.5) or (bmi <= 24.9): print ("Normal") elif (bmi == 25) or (bmi <= 29.9): print ("Overweight") else: print ("Obesity")

0

It worked in me: #your code goes here weight = int(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') else: print('Obesity')