BMI Calculator

Easy
23
3
84.7% Acceptance

In this lab, you are tasked with creating a Python function named calculate_bmi to calculate the Body Mass Index (BMI) based on a person's height in centimeters and weight in kilograms.

Function Requirements:

  • Input Parameters:
    • height (in centimeters)
    • weight (in kilograms)
  • Output:
    • A tuple (bmi_value, category)
    • bmi_value should be the BMI, calculated as weight (kg) / (height (m))^2 and rounded to two decimal places.
    • category should be a string indicating the BMI category: "underweight", "healthy", "overweight", or "obese".
BMI RangeCategory
Less than 18.5Underweight
18.5 - 24.9Normal weight
25 - 29.9Overweight
30 and aboveObese

Output Formatting:

  • The BMI value must be restricted to 2 decimal places.
  • The category string should be in lowercase and trimmed of any extra spaces.

Examples:

  1. Input: calculate_bmi(170, 82.2)
    Expected Output: (28.41, "overweight")

  2. Input: calculate_bmi(150, 77.1)
    Expected Output: (34.27, "obesity")