Bmi calculator final project on python for beginners | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Bmi calculator final project on python for beginners

What did I do wrong? I’ve edited three different times and still not working. I even changed the or to and. This is my code. weight = int(input()) height = float(input()) bmi = weight/(height**weight) if (bmi<18.5): print("underweight") elif (bmi>=18.5 or <25.0): print("normal") elif (bmi>=25.0 or <30.0): print("overweight") elif (bmi>=30.0): print("obesity") Can someone please help me even my notes are starting to not make sense.

7th Feb 2022, 9:44 PM
Carmilla Boykin
Carmilla Boykin - avatar
7 Answers
+ 2
Simon Sauter i figured it out. It was weight = int(input()) height = float(input()) bmi = weight/height**2 if (bmi < 18.5): print("Underweight") elif (bmi >= 18.5) and (bmi < 25.0): print("Normal") elif (bmi >= 25.0) and (bmi < 30.0): print("Overweight") elif (bmi >= 30.0): print("Obesity") Thank you so much for your help.
7th Feb 2022, 10:18 PM
Carmilla Boykin
Carmilla Boykin - avatar
+ 1
1. Unident the elif statements. 2. Your outputs have to start with a capital letter (e.g. "Obesity"). 3. bmi = weight/height**2
7th Feb 2022, 9:50 PM
Simon Sauter
Simon Sauter - avatar
+ 1
Simon Sauter okay i tried that and still have error this is the new version is there anything else im not noticing? weight = int(input()) height = float(input()) bmi = weight/height**2 if (bmi < 18.5): print("Underweight") elif (bmi >= 18.5 or < 25.0): print("Normal") elif (bmi >= 25.0 or < 30.0): print("Overweight") elif (bmi >= 30.0): print("Obesity")
7th Feb 2022, 9:59 PM
Carmilla Boykin
Carmilla Boykin - avatar
+ 1
In the second and third elif statements replace "or" with "and".
7th Feb 2022, 10:01 PM
Simon Sauter
Simon Sauter - avatar
+ 1
Simon Sauter changed it and still not working :/ heres the updated version. weight = int(input()) height = float(input()) bmi = weight/height**2 if (bmi < 18.5): print("Underweight") elif (bmi >= 18.5 and < 25.0): print("Normal") elif (bmi >= 25.0 and < 30.0): print("Overweight") elif (bmi >= 30.0): print("Obesity")
7th Feb 2022, 10:04 PM
Carmilla Boykin
Carmilla Boykin - avatar
+ 1
Try with weight as float instead of int.
7th Feb 2022, 10:11 PM
Simon Sauter
Simon Sauter - avatar
0
#TRY THIS #Use your indentation properly w =float(input()) h =float(input()) bmi = w/h**2 if bmi < 18.5: print("Underweight") elif bmi >= 18.5 and w/h <25: print("Normal") elif bmi >=25 and w/h <30; print("Overweight") else: print("Obesity")
8th Feb 2022, 11:39 AM
Anshuman Routray
Anshuman Routray - avatar