Skip to content

Instantly share code, notes, and snippets.

@ljmccarthy
Created July 1, 2015 09:07
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 ljmccarthy/d75434090496be60552e to your computer and use it in GitHub Desktop.
Save ljmccarthy/d75434090496be60552e to your computer and use it in GitHub Desktop.
import sys
from decimal import Decimal, ROUND_UP
def ebay_postage_price(p):
d = p * (1 / (1 - Decimal('0.134'))) + Decimal('0.20')
return d.quantize(Decimal('0.1'), rounding=ROUND_UP)
for x in sys.argv[1:]:
print(format(ebay_postage_price(Decimal(x)), '.2f'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment