forked from dominict/pythonteachingcode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is just an extra demo file.
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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")) |