﻿ Python: Calculate body mass index - w3resource

# Python: Calculate body mass index

## Python Basic: Exercise-66 with Solution

Write a Python program to calculate the body mass index.

Pictorial Presentation:

Sample Solution:

Python Code:

``````# Prompt the user to input their height in feet and convert it to a floating-point number.
height = float(input("Input your height in Feet: "))

# Prompt the user to input their weight in kilograms and convert it to a floating-point number.
weight = float(input("Input your weight in Kilograms: "))

# Calculate the body mass index (BMI) using the provided height and weight and round it to 2 decimal places.
bmi = weight / (height * height)
rounded_bmi = round(bmi, 2)

# Print the calculated BMI.
print("Your body mass index is: ", rounded_bmi)
```
```

Sample Output:

```Input your height in Feet:  6
Input your weight in Kilogram:  65
Your body mass index is:  1.81
```

Flowchart:

Python Code Editor:

What is the difficulty level of this exercise?

Test your Programming skills with w3resource's quiz.

﻿