+ 4

My output is (Underweight) with space under it. .... Expected output (Underweight) without space 😑 help me in that project

https://code.sololearn.com/cV42ithI26i9/?ref=app

31st Aug 2021, 6:26 PM
Hayam Mohammed
Hayam Mohammed - avatar
55 Antworten
0
https://code.sololearn.com/c0ZgTf0yT1u0/?ref=app
2nd Sep 2021, 4:22 PM
Hayam Mohammed
Hayam Mohammed - avatar
+ 6
That means your code is correct. Don't worry about the space – it's not related to your code
31st Aug 2021, 8:30 PM
Lisa
Lisa - avatar
+ 5
Nothing to fix, it's just how sololearn displays it. It doesn't have anything to do with your code. So which test case shows an error?
31st Aug 2021, 8:00 PM
Lisa
Lisa - avatar
+ 3
Hayam Mohammed Try this: weight=int(input()) height=float(input()) BMI=weight/(height**2) if BMI<18.5: print("Underweight") elif 18.5>=BMI and BMI< 25: print('Normal') elif 25<= BMI and BMI<30: print("Overweight") else: print('Obesity') You are getting an error because you didn't use the and operator for Normal and Overweight. The and operator is important for this type of code. I hope you understand.
1st Sep 2021, 1:07 PM
Musab Yusuff 🇳🇬
Musab Yusuff 🇳🇬 - avatar
+ 2
your Bmi calculation formula is wrong, bmi formula is :- weight(kg)/height(m)^2 so BMI = weight / (height/100)**2; https://code.sololearn.com/cpfjqSZMgu4v/?ref=app
31st Aug 2021, 6:45 PM
CodeSmith
CodeSmith - avatar
+ 2
What did you input? Weight is in kg Height in m
31st Aug 2021, 7:09 PM
Lisa
Lisa - avatar
+ 2
But it shows green (passed)? The space below could just be the field size and not due to your code?
31st Aug 2021, 7:51 PM
Lisa
Lisa - avatar
+ 2
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') elif BMI > 30 : print('Obesity') Try using this one
2nd Sep 2021, 6:23 AM
Divyansh Juyal
+ 2
Finally guys i've passed the project Thanks to **🇦🇪|🇦🇪**
2nd Sep 2021, 4:18 PM
Hayam Mohammed
Hayam Mohammed - avatar
+ 1
We cant use the link in a tag. Just put it in the description
31st Aug 2021, 6:29 PM
Brain & Bones
Brain & Bones - avatar
+ 1
Sorry, it's my first question
31st Aug 2021, 6:33 PM
Hayam Mohammed
Hayam Mohammed - avatar
+ 1
Note that you have a typo in overweight
31st Aug 2021, 6:57 PM
Lisa
Lisa - avatar
+ 1
Andy_Roid thanks for help But your formula gives me the output (obesity) while the expected output is Underweight
31st Aug 2021, 7:05 PM
Hayam Mohammed
Hayam Mohammed - avatar
+ 1
The project height input is in meters so i think the formula is right
31st Aug 2021, 7:08 PM
Hayam Mohammed
Hayam Mohammed - avatar
+ 1
Hayam Mohammed Go through the link u'll figure it out.
31st Aug 2021, 7:08 PM
CodeSmith
CodeSmith - avatar
+ 1
Hayam Mohammed when calculating height in meters, and weight in Kilograms
31st Aug 2021, 7:09 PM
CodeSmith
CodeSmith - avatar
+ 1
Hayam Mohammed Input height in cm's and weight in kilograms, but when calculating height in mtrs and weight in kgs
31st Aug 2021, 7:12 PM
CodeSmith
CodeSmith - avatar
+ 1
So does it work now?
31st Aug 2021, 7:14 PM
Lisa
Lisa - avatar
+ 1
Your code seems to work as expected. Which test case fails?
31st Aug 2021, 7:25 PM
Lisa
Lisa - avatar