 What is the code to the project of bmi calculator in python 3? | SoloLearn: Learn to code for FREE!

0

# What is the code to the project of bmi calculator in python 3?

I hv tried multiple times but error occurs everytime

14 Answers

New Answer

+2

I don't know how sl calculates bmi, so if its a problem with the math, that's on you. BUT, when checking a single value against multiple values in a single if/elif statement use the value to compare both times: BAD: ... elif BMI >= 25 and < 30: ... GOOD: ... elif (BMI >= 25) and (BMI < 30): ... See how the "GOOD" one has the variable in it twice? That's needed if you want to compare it against multiple values

+1

Ohk..thanks! I will remember that next time

+1

Just change to weight = float(input()) height = float(input()) As explained by Slick

+1

Got it, thanks slick and Aditya!

0

Well try again, noone will just give you the answer.

0

I don't want the exact answer.i just want to check where i am going wrong

0

It sure looks like you did! You didn't post your code or explain any issue your having. You literally said: "What is the code to the project of bmi calculator in python 3?"

0

weight = float(input("85")) height = float(input("1.9")) BMI = weight/(height**2) if BMI<18.5: print("Underweight") elif BMI>=18.5 and <25: print("Normal") elif BMI>=25 and <30: print("Overweight") else: print("Obesity") See i hv posted the code now.Can u help where i am going wrong?

0

0

0

weight = float(input("85")) height = float(input("1.9")) 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")

0

what is float(input("85")) for??? float() turns stuff into floats input() takes user input thats typed AFTER the program starts when a string is included in input(), for example: choice = input("Enter a choice: ") that string is a prompt, not anything to do w/ the variable. You may need to go over input/output again

0

Try this: w = int(input()) h = float(input()) bmi = w / (h*h) 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")

-1

weight=float(input()) height=float(input()) bmi=weight/(height**2) if bmi<18.5: print("Underweight") if bmi>=18.5 and bmi<25: print("Normal") if bmi>=25 and bmi<30: print("Overweight") if bmi>=30: print("Obesity") This was my answer then....try check it out