Skip to content

Instantly share code, notes, and snippets.

@Achifaifa
Created August 21, 2014 11:21
Show Gist options
  • Save Achifaifa/27005dd346a236681cc8 to your computer and use it in GitHub Desktop.
Save Achifaifa/27005dd346a236681cc8 to your computer and use it in GitHub Desktop.
Program to calculate prices from base price, VAT and transport costs
#!/usr/bin/env python
import sys
try:
price=int(sys.argv[1])
tax={"A":21,"B":10,"C":4}[sys.argv[2]]
transp=(price*int(sys.argv[3]))/100
totvar=price+((price+transp)*tax/100)
print "Base price: %i + %i%% VAT + %i%% transport = %i" %(price,tax,transp,totvar)
except:
print "Use: pricecalc.py [price] [VAT] [transport]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment