Skip to content

Commit d97f959

Browse files
committed
Adding functions examples file
This is just an extra demo file.
1 parent 0280ac0 commit d97f959

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

functions_play.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'''
2+
This is a file full of functions examples.
3+
'''
4+
5+
def calculate_bmi(height, weight, units="standard"):
6+
'''
7+
This function calculates BMI and returns the value. It expects height in inches and weight in pounds.
8+
Change units to metric if metric. Then input KG and Meters.
9+
'''
10+
11+
if units == "standard":
12+
bmi = (weight/(height*height))*703
13+
else:
14+
bmi = weight/(height*height)
15+
return bmi
16+
17+
print("standard case: ",calculate_bmi(62,138))
18+
19+
print("metric case: ",calculate_bmi(1.575,62.596,"metric"))

0 commit comments

Comments
 (0)