Skip to content

Instantly share code, notes, and snippets.

@kigawas
Created January 12, 2023 08:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kigawas/8de72c6f9fc883573f8316946e270cc1 to your computer and use it in GitHub Desktop.
Save kigawas/8de72c6f9fc883573f8316946e270cc1 to your computer and use it in GitHub Desktop.
Calculate how much water you need to drink every day
def water_metabolism(
activity_level: float, # 1.5: static, 1.75: intermediate, 2: dynamic
weight: float, # in kgs
gender: int, # 0: female, 1: male
humidity: int = 50, # in percent, e.g. 50
is_athlete: int = 0, # 0: not athlete, 1: athlete
hdi: int = 0, # 0: developed countries, 1: intermediate, 2: developing countries
above_sea_level: float = 25, # in metres
age: float = 30, # your current age
temperature: float = 15, # average daily temperature in celsius, e.g. 15
) -> float:
# ref: https://www3.nhk.or.jp/news/html/20221125/k10013902711000.html
return (
1076 * activity_level
+ 14.34 * weight
+ 374.9 * gender
+ 5.823 * humidity
+ 1070 * is_athlete
+ 104.6 * hdi
+ 0.4726 * above_sea_level
- 0.3529 * age**2
+ 24.78 * age
+ 1.865 * temperature**2
- 19.66 * temperature
- 713.1
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment