# 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:**

**Previous:** Write a Python program to convert seconds to day, hour, minutes and seconds.

**Next:** Write a Python program to convert pressure in kilopascals to pounds per square inch,a millimeter of mercury (mmHg) and atmosphere pressure.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- 100 Python Projects for Beginners with solution
- Mastering NumPy: 100 Exercises with solutions
- SQL Tutorial
- SQL Inner Join
- Python Exercises, Practice, Solution
- Python Interview Questions and Answers: Comprehensive Guide
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript HTML Form Validation
- Java Collection Exercises