Advertisement
Guest User

Untitled

a guest
Feb 9th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.34 KB | None | 0 0
  1. nets = [12000,24000,36000,48000,60000]
  2.  
  3. tax = {
  4.     'personalAllowance' :    11850,
  5.     'basicRate' :            0.2,
  6.     'basicRateUpperLimit' :  46350,
  7.     'higherRate' :           0.4,
  8.     'higherRateUpperLimit' : 150000,
  9.     'additionalRate' :       0.45
  10. }
  11. nic = {
  12.     'lowerProfitsLimit' : 8424,
  13.     'upperProfitsLimit' : 46356,
  14.     'basicRate' :         0.12,
  15.     'higherRate' :        0.02
  16. }
  17.  
  18. threshold1 = nic['lowerProfitsLimit']
  19. threshold2 = tax['personalAllowance'] - nic['basicRate'] * (tax['personalAllowance'] - nic['lowerProfitsLimit'])
  20. threshold3 = (tax['personalAllowance'] + tax['basicRateUpperLimit']) - tax['basicRate'] * tax['basicRateUpperLimit'] - nic['basicRate'] * (nic['upperProfitsLimit'] - nic['lowerProfitsLimit'])
  21. threshold4 = (tax['personalAllowance'] + tax['higherRateUpperLimit']) - tax['higherRate'] * (tax['higherRateUpperLimit'] - tax['basicRateUpperLimit']) - tax['basicRate'] * tax['basicRateUpperLimit'] - nic['higherRate'] * (tax['personalAllowance'] + tax['higherRateUpperLimit'] - nic['upperProfitsLimit']) - nic['basicRate'] * (nic['upperProfitsLimit'] - nic['lowerProfitsLimit'])
  22.  
  23. for net in nets:
  24.     print "net: {}".format(net)
  25.  
  26.     if net <= threshold1:
  27.         print net
  28.  
  29.     elif net <= threshold2:
  30.         gross = (net - nic['basicRate'] * nic['lowerProfitsLimit']) / (1 - nic['basicRate'])
  31.  
  32.     elif net <= threshold3:
  33.         gross = (net - (nic['basicRate'] * nic['lowerProfitsLimit']) - tax['basicRate'] * (tax['personalAllowance'])) / (1 - nic['basicRate'] - tax['basicRate'])
  34.  
  35.     elif net <= threshold4:
  36.         gross = (net * 1 + nic['basicRate'] * (nic['upperProfitsLimit'] - nic['lowerProfitsLimit']) + tax['basicRate'] * tax['basicRateUpperLimit'] - nic['higherRate'] * nic['upperProfitsLimit'] - tax['higherRate'] * (tax['personalAllowance'] + tax['basicRateUpperLimit'])) / (1 - nic['higherRate'] - tax['higherRate'])
  37.  
  38.     else:
  39.         gross = (net * 1 + nic['basicRate'] * (nic['upperProfitsLimit'] - nic['lowerProfitsLimit']) + tax['basicRate'] * tax['basicRateUpperLimit'] + tax['higherRate'] * (tax['higherRateUpperLimit'] - tax['basicRateUpperLimit']) - nic['higherRate'] * nic['upperProfitsLimit'] - tax['additionalRate'] * (tax['higherRateUpperLimit'] + tax['personalAllowance'])) / (1 - nic['higherRate'] - tax['additionalRate'])
  40.  
  41.     print "gross: {}".format(gross)
  42.     print "----------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement