healthsciencecalculator.unit_convert

Functions

unit_convert(value, input_unit, output_unit)

Converts values from one unit to another.

Module Contents

healthsciencecalculator.unit_convert.unit_convert(value: float, input_unit: str, output_unit: str)[source]

Converts values from one unit to another.

Supported measurement units: - Weight: kg, g, lb, stone - Length: m, cm, feet, inch - Temperature: C, F - Concentration: mg/dL, mmol/L - Volume: L, mL

Parameters:
  • value (float) – The numeric value to be converted.

  • input_unit (str) – The unit of input value.

  • output_unit (str) – The desired unit of output value.

Returns:

The output value in desired unit.

Return type:

float

Examples

>>> unit_convert(1, "m", "cm")
100