Help for construct a code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help for construct a code

BMI calculator

11th Apr 2021, 1:47 PM
vijayalakshmi T.G.
vijayalakshmi T.G. - avatar
6 Answers
+ 2
https://code.sololearn.com/cupl1zhV3BtR/?ref=app Here is your code. You had some basic errors in your code
11th Apr 2021, 2:07 PM
Vinayak
Vinayak - avatar
+ 2
What are those errors i am not able to identify
11th Apr 2021, 2:11 PM
vijayalakshmi T.G.
vijayalakshmi T.G. - avatar
+ 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.
11th Apr 2021, 2:17 PM
Vinayak
Vinayak - avatar
+ 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
11th Apr 2021, 1:54 PM
vijayalakshmi T.G.
vijayalakshmi T.G. - avatar
+ 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 👌
11th Apr 2021, 2:41 PM
karimireza77
karimireza77 - avatar
+ 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")
28th Dec 2022, 4:37 AM
manoj nerella
manoj nerella - avatar