# Upgrade Python code

**URL:** <https://forum.codewithmosh.com/t/upgrade-python-code/10435>\
**Category:** Python\
**Created:** [February 4, 2022, 3:22pm UTC](https://forum.codewithmosh.com/t/upgrade-python-code/10435 "2022-02-04T15:22:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lt.Smith](https://avatars.discourse-cdn.com/v4/letter/l/3bc359/32.png) [@Lt.Smith](https://forum.codewithmosh.com/u/Lt.Smith)\
**Post date:** [February 4, 2022, 3:22pm UTC](https://forum.codewithmosh.com/t/upgrade-python-code/10435/1 "2022-02-04T15:22:41Z")

</div>

# BMI Calculator

Tracking your BMI is a useful way of checking if you’re maintaining a healthy weight. It’s calculated using a person’s weight and height, using this formula: **weight / height²**

The resulting number indicates one of the following categories:  
**Underweight** = less than 18.5  
**Normal** = more or equal to 18.5 and less than 25  
**Overweight** = more or equal to 25 and less than 30  
**Obesity** = 30 or more

Let’s make finding out your BMI quicker and easier, by creating a program that takes a person’s weight and height as input and outputs the corresponding BMI category.

**Sample Input**  
85  
1.9

**Sample Output**  
Normal

and my code :

weight = float(input(“”))

height = float(input(“”))

BMI = weight / (height\*\*height)

if BMI \< 18.5:

```
print("Underweight")

```

elif BMI \>= 18.5 and BMI \< 25:

```
print("Normal")

```

elif BMI \>= 25 and BMI \< 30:

```
print("Overweight")

```

elif BMI \>= 30:

```
print("Obesity")

```

The problem has 5 situations: my code is good for only 3 out of 5, how can I improve my code ?

Thank you in advance! 😃
