BMI Category Classifier

Medium ⏱ 12 min 54% acceptance ★★★★☆ 4.3
Write a function bmi_category(weight_kg, height_m) that computes bmi = weight_kg / height_m ** 2 and returns the category: "Underweight" (bmi < 18.5), "Normal" (18.5 <= bmi < 25), "Overweight" (25 <= bmi < 30), or "Obese" (bmi >= 30). Round the computed bmi to 1 decimal place before comparing is not required — compare the raw value.

Examples

Example 1
Input
bmi_category(70, 1.75)
Output
"Normal"
Explanation

bmi = 70/1.75**2 ≈ 22.86, which is Normal.

Example 2
Input
bmi_category(45, 1.70)
Output
"Underweight"
Explanation

bmi ≈ 15.57, below 18.5.

Constraints

  • weight_kg and height_m are positive numbers.

Topics

Conditional Statementsif/elif/else

Companies

AppleCisco

Hints

Hint 1

Compute bmi first, then branch on it.

Hint 2

Use `<` and `>=` boundaries consistently so ranges do not overlap.

Loading the Python runtime… Run executes your code and shows printed output; Submit checks your function against this problem's examples.