Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- Tax calc for CA residents. Does not include property tax, child credits etc.
- '''
- SLABS = [
- (10, 9525, 19050),
- (12, 38700, 77400),
- (22, 82500, 165000),
- (24, 157500, 315000),
- (32, 200000, 400000),
- (35, 500000, 600000)]
- CASLABS = [
- (1, 7850, 15700),
- (2, 18610, 37220),
- (4, 29372, 58744),
- (6, 40773, 81546),
- (8, 51530, 103060),
- (9.30, 263222, 526444),
- (10.3, 315866, 631732),
- (11.3, 526443, 1052886),
- ]
- def fica(inc):
- tax = min(inc, 127200.) * 6.2 / 100.
- tax += min(inc, 200000) * 1.45/100.
- if inc > 200000:
- tax += (inc - 200000) * 2.35/100.
- return tax
- def _calc(inc, slabs, highest):
- tax = 0.
- for rate, limit in slabs:
- if inc > limit:
- tax += rate * limit / 100.
- inc -= limit
- else:
- tax += rate * inc / 100.
- inc = 0.
- if inc > 0:
- tax += highest * inc / 100.
- return tax
- def calc(inc, issingle):
- if issingle:
- state = _calc(inc - 3992, [(e[0], e[1]) for e in CASLABS], 12.3)
- ded = min(10000, state)
- return fica(inc) + state + _calc(inc - 12000 - ded, [(e[0], e[1]) for e in SLABS], 37.)
- else:
- state = _calc(inc - 7984, [(e[0], e[2]) for e in CASLABS], 12.3)
- ded = min(10000, state)
- return fica(inc) + state + _calc(inc - 24000, [(e[0], e[2]) for e in SLABS], 37.)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement