Skip to content

Instantly share code, notes, and snippets.

@lost-theory
Last active August 29, 2015 14:10
Show Gist options
  • Save lost-theory/e90014c1d1d6bcf4ca2c to your computer and use it in GitHub Desktop.
Save lost-theory/e90014c1d1d6bcf4ca2c to your computer and use it in GitHub Desktop.
vitamin C
>>> orange_vit_c = "78 mg, 130%"
>>> orange_vit_c = (78, 130) #mg, %
>>> tablet_vit_c = (250, 416)
>>> 250/78.0
3.2051282051282053
>>> 416/130.
3.2
>>> drink_vit_c = (None, 1500)
>>> rda_vit_c = (90, 100)
>>> #i've eaten 1500 + (416*3) percentage points of Vitamin C
...
>>> (78/130.0, 250/416.0)
(0.6, 0.6009615384615384)
>>> mgs_per_percent_pt = 0.6
>>> 130 * mgs_per_percent_pt
78.0
>>> 1500 * mgs_per_percent_pt
900.0
>>> drink_vit_c = (900, 1500)
>>> MG, PCT = 0, 1
>>> sum([x[PCT] for x in [tablet_vit_c, tablet_vit_c, tablet_vit_c, drink_vit_c]])
2748
>>> 1500+(416*3)
2748
>>> sum([x[MG] for x in [tablet_vit_c, tablet_vit_c, tablet_vit_c, drink_vit_c]])
1650
>>> upper_limit_vit_c = (2000, 2000/0.6)
>>> #so i've consumed 1650mg of vitamin C today
... #and the UL is 2000mg, so if i take one more tablet I'm over the UL
...
>>> 1650+tablet_vit_c[MG]
1900
>>> #two more tablets actually...
...
>>> #Stone[33] and Pauling[34] believe that the optimum daily requirement of vitamin C is around 2,300 milligrams for a human requiring 2,500 kcal a day.
...
>>> upper_limit_vit_c[PCT]
3333.3333333333335
>>> #so you can drink like 2.5 of those smoothie drinks to get to the UL
...
>>> emergen_c_vit_c = (1000, 1667)
>>> #or two Emergen-C fizzy drinks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment