Skip to content

Instantly share code, notes, and snippets.

@matthewjberger
Last active February 2, 2017 18:43
Show Gist options
  • Save matthewjberger/7315043f9b11f67aa84f22642365b180 to your computer and use it in GitHub Desktop.
Save matthewjberger/7315043f9b11f67aa84f22642365b180 to your computer and use it in GitHub Desktop.
An algorithm to approximate bodyfat percentage - https://repl.it/EtYI/2
def calcBf(weightLbs, waistGirthAroundBellyButton):
m = 1.082 * weightLbs
n = 4.15 * waistGirthAroundBellyButton
bfLbs = 94.42 + m - n
bfDiffLbs = abs(weightLbs - bfLbs)
bfPercent = 100 * (bfDiffLbs/weightLbs)
print("You are " + "{0:.2f}".format(bfPercent) +"% bodyfat")
calcBf(156, 33)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment