Skip to content

Instantly share code, notes, and snippets.

@nafu
Created February 18, 2013 15:16
Show Gist options
  • Save nafu/4978123 to your computer and use it in GitHub Desktop.
Save nafu/4978123 to your computer and use it in GitHub Desktop.
# 1 pound == 16 ounces
def ounce2pound(ounce):
return ounce/16.0
def cost(ounces):
return round(1.99*ounce2pound(ounces), 2)
print cost(1)
print cost(2)
print cost(3)
print cost(4)
print cost(5)
print cost(6)
print cost(7)
print cost(8)
print cost(9)
print cost(10)
print cost(11)
print cost(12)
print cost(13)
print cost(14)
print cost(15)
print cost(16)
print cost(17)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment