0

Can someone please explain to me what exactly I did wrong? I'm probably just missing something (Python)

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

3rd May 2021, 10:18 AM
LOL CLOWN
LOL CLOWN - avatar
11 Respuestas
+ 1
The input should be fine like this: Weight= input(float()) Height = input(float()) if bmi < 18.5: print ("Underweight") elif (bmi => 18.5 and < 25): print ("Normal") elif (bmi > 25 and < 30): print ("Overweight") else: print ("Obese")
3rd May 2021, 10:25 AM
Noobmaster
Noobmaster - avatar
+ 3
Hey LOL CLOWN 1.Take weight as float ! 2.missing colon at if statement 3. don't write => that's error write >= 4.write BMI>=18.5 and BMI<25 (BMI must come two times for condition)
3rd May 2021, 10:21 AM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar
+ 1
You missing colon(:) and also there is wrong indentation
3rd May 2021, 10:21 AM
YUGRAJ
+ 1
Here is corrected code there was lot of errors in yours
3rd May 2021, 10:27 AM
YUGRAJ
+ 1
Yeah don't afraid of making mistake but make sure you should not repeat mistake. Good luck
3rd May 2021, 10:32 AM
YUGRAJ
+ 1
LOL CLOWN Try this: #your code goes here weight = int(input()); height = float(input()); bmi = weight/float(height*height); 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')
4th May 2021, 10:08 PM
❤️😍Prerana😍❤️
❤️😍Prerana😍❤️ - avatar
+ 1
weight = input() height = float(input()) heightsquare = float(height * height) bmi = float(float(weight )/ heightsquare) 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")
5th May 2021, 4:52 AM
Vetrivel Subramani
Vetrivel Subramani - avatar
0
Thanks for the help. I made weight a float variable and put colon. Can you explain what's indentation ? Also is there something wrong with my first if clause?
3rd May 2021, 10:24 AM
LOL CLOWN
LOL CLOWN - avatar
0
weight = float(input()) height = float(input()) heightsquare = float(height * height) bmi = float(weight / heightsquare) 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 ("Obese")
3rd May 2021, 10:27 AM
YUGRAJ
0
Sorry for the errors, I'm new here. I think I'll keep missing colons here and there and what not. Thanks for all the help
3rd May 2021, 10:29 AM
LOL CLOWN
LOL CLOWN - avatar
- 1
Hey Spooderman and YUGRAJ Don't send answers , let them try themselves , how will they improve .Yes you have solved code but don't give next time.
3rd May 2021, 10:32 AM
Giriraj Yalpalwar
Giriraj Yalpalwar - avatar