Skip to content

Instantly share code, notes, and snippets.

@rcoder
Last active August 3, 2019 21:18
Show Gist options
  • Save rcoder/ffbf0769aebe34b99f21d9e55c6f9997 to your computer and use it in GitHub Desktop.
Save rcoder/ffbf0769aebe34b99f21d9e55c6f9997 to your computer and use it in GitHub Desktop.
⋊> ~ python3 12:16:25
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> cal2j = lambda x: x*4.184 # calories -> joules
>>> oz2ml = lambda v: v*20.574 # ounces -> milliliters
>>> vol = oz2ml(2) # 2 oz. serving
>>> cold = 4.5 # 4.5C, or ~40F
>>> warm = 40 # 40C, or ~105F
>>> heat = warm - cold
>>> energy = cal2j(vol * heat) # watts needed
>>> energy
6111.794736000001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment