+ 1
Help for construct a code
BMI calculator
6 Réponses
+ 2
https://code.sololearn.com/cupl1zhV3BtR/?ref=app
Here is your code. You had some basic errors in your code
+ 2
What are those errors i am not able to identify
+ 2
=> You had used "Print" instead of "print"
=> In python you need to add whitespace at the beginning of the block of code which you had missed
You can read about python indentation here
https://www.w3schools.com/python/gloss_python_indentation.asp#:~:text=Indentation%20refers%20to%20the%20spaces,indicate%20a%20block%20of%20code.
+ 1
hieght=float (input ("Enter hieght in m:"))
Weight =(input (Enter weight in kg:"))
bmi=weight/(hieght*hieght )
Print (f"bmi is {bmi}")
if (bmi <18.5):
Print ("under weight ")
elif (18.5 <bmi and bmi <25):
Print ("normal")
elif (25 <bmi and bmi <30):
Print("over weight ")
elif (bmi >30):
Print("obesity")
It is my code but it shows error as expect intended block
+ 1
weight = int(input())
height = float(input())
BMI = (weight / (height**2))
if BMI < 18.5:
print("Underweight")
elif (25 > BMI):
print("Normal")
elif (30 > BMI):
print("Overweight")
elif BMI >= 30:
print("Obesity")
it is nice and clean code i write 👌
+ 1
weight = int(input())
height = float(input())
BMI = (weight / (height**2))
if BMI < 18.5:
print("Underweight")
elif (25 > BMI):
print("Normal")
elif (30 > BMI):
print("Overweight")
elif BMI >= 30:
print("Obesity")