#! /usr/bin/env python3 # def bmi ( weight_lb, height_in ): ''' Purpose: bmi() computes the BMI (body mass index). Discussion: the BMI has a simple formula when the input is defined in metric units This program accepts data in English units (pounds and inches) and applies the correct unit conversions. An "ideal" BMI is between 18.5 and 30. Above 30 begins to count as "obese" and below 18.5 is considered "underweight". Example: bmi ( 150, 60 ) returns the value 29.30 Modified: 12 May 2022 Author: John Burkardt Reference: https://en.wikipedia.org/wiki/Body_mass_index Input: weight_lb, the weight in pounds. height_in, the height in inchdes. Output: value, the body mass index. ''' value = ( weight_lb / 2.204 ) * ( 39.370 / height_in )**2 return value def c_to_f ( c ): f = ( 9 / 5 ) * c + 32 return f def c_to_k ( c ): k = c + 273.15 return k def f_to_c ( f ): c = ( 5 / 9 ) * ( f - 32 ) return c def f_to_k ( f ): c = f_to_c ( f ) k = c + 273.15 return k def k_to_c ( k ): c = k - 273.15 return c def k_to_f ( k ): c = k - 273.15 f = c_to_f ( c ) return f if ( __name__ == "__main__" ): print ( '' ) print ( 'value = bmi ( weight_lb, height_in ) demonstration:' ) print ( '' ) value = bmi ( 100, 50 ) print ( ' bmi(100,50) = ', value ) value = bmi ( 150, 60 ) print ( ' bmi(150,60) = ', value ) value = bmi ( 200, 70 ) print ( ' bmi(200,70) = ', value ) print