Created
August 21, 2014 11:21
-
-
Save Achifaifa/27005dd346a236681cc8 to your computer and use it in GitHub Desktop.
Program to calculate prices from base price, VAT and transport costs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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