Skip to content

Instantly share code, notes, and snippets.

@andrewschaaf
Created April 17, 2011 02:48
Show Gist options
  • Save andrewschaaf/923705 to your computer and use it in GitHub Desktop.
Save andrewschaaf/923705 to your computer and use it in GitHub Desktop.
taco = 2.50
fish_taco = 3.00
burrito = 8.00
personal_subtotals =
andrew: burrito + taco
gabriel: taco + fish_taco
mark: taco + taco
sheldon: burrito
subtotal = 0
for name, personal_subtotal of personal_subtotals
subtotal += personal_subtotal
for name, personal_subtotal of personal_subtotals
usd = 37 * (personal_subtotal / subtotal)
console.log "#{name} owes #{usd / 1.10} BTC"
###
andrew owes 12.178683385579935 BTC
gabriel owes 6.379310344827585 BTC
mark owes 5.799373040752351 BTC
sheldon owes 9.27899686520376 BTC
>>> 16nPW2FtPCD9F7JNE7DVkYsmsaZG9Mcqjh <<<
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment