Problem 180563 · easy · Phase 01 Prerequisites & Setup

BMI Category

conditionals · arithmetic

Body mass index is weight / height**2 with weight in kilograms and height in metres. Write bmi_category(weight_kg, height_m) that returns:

  • "underweight" if BMI is below 18.5
  • "normal" if BMI is at least 18.5 and below 25
  • "overweight" if BMI is at least 25 and below 30
  • "obese" if BMI is 30 or more

Examples

Input:  weight_kg = 70, height_m = 1.75
Output: "normal"

Input:  weight_kg = 50, height_m = 1.8
Output: "underweight"

Input:  weight_kg = 95, height_m = 1.7
Output: "obese"

Constraints

  • 20 <= weight_kg <= 300
  • 1.0 <= height_m <= 2.5

Goals

  • Compute a value and then classify it
  • Use strict and non-strict comparisons correctly at the boundaries
Starting Python…