Skip to content

Instantly share code, notes, and snippets.

@ktwrd
Created May 5, 2020 02:51
Show Gist options
  • Save ktwrd/e9cf4d12aa8685e0ab716203d0205a1c to your computer and use it in GitHub Desktop.
Save ktwrd/e9cf4d12aa8685e0ab716203d0205a1c to your computer and use it in GitHub Desktop.
BMR Calculator for Python3
sex = str(input("[M]ale or [F]emale: "))
weight = int(input("Weight in kg: "))
height = int(input("Height in cm: "))
age = int(input("Age in years: "))
if sex == "m" or sex == "M":
formula = 66 + (13.7 * weight) + (5 * height) - (6.8 * age)
elif sex == "f" or sex == "F":
formula = 655 + (9.6 * weight) + (1.8 * height) - (4.7 * age)
else:
print("try using your brain next time!")
print("BMR: " + str(formula))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment