body_mass_index.nbt 316 B

12345678910
  1. # This script calculates the Body Mass Index (BMI) based on
  2. # the provided mass and height values.
  3. unit BMI: Mass / Length^2 = kg / m^2
  4. fn body_mass_index(mass: Mass, height: Length) =
  5. mass / height² -> BMI
  6. print(body_mass_index(70 kg, 1.75 m))
  7. assert_eq(body_mass_index(70 kg, 1.75 m), 22.86 BMI, 0.01 BMI)