From d97f959efef5bcd0842612fdc848070be45fbee5 Mon Sep 17 00:00:00 2001 From: Dominic Thomas Date: Mon, 22 Apr 2024 11:45:07 -0400 Subject: [PATCH] Adding functions examples file This is just an extra demo file. --- functions_play.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 functions_play.py diff --git a/functions_play.py b/functions_play.py new file mode 100644 index 0000000..94b55d2 --- /dev/null +++ b/functions_play.py @@ -0,0 +1,19 @@ +''' +This is a file full of functions examples. +''' + +def calculate_bmi(height, weight, units="standard"): + ''' + This function calculates BMI and returns the value. It expects height in inches and weight in pounds. + Change units to metric if metric. Then input KG and Meters. + ''' + + if units == "standard": + bmi = (weight/(height*height))*703 + else: + bmi = weight/(height*height) + return bmi + +print("standard case: ",calculate_bmi(62,138)) + +print("metric case: ",calculate_bmi(1.575,62.596,"metric")) \ No newline at end of file