Skip to content

Instantly share code, notes, and snippets.

@dmanchon
Created February 12, 2018 06:39
Show Gist options
  • Save dmanchon/d2085b7db89b42b13a874b376257630c to your computer and use it in GitHub Desktop.
Save dmanchon/d2085b7db89b42b13a874b376257630c to your computer and use it in GitHub Desktop.
tramos = [
(0, 12450, 19),
(12450, 20200, 24),
(20200, 35200, 30),
(35200, 60000, 37),
(60000, None, 45)
]
def calculo(salario, pagas=12):
t = []
for tramo in tramos:
if tramo[0] > salario:
break
elif tramo[1] == None or tramo[1] > salario:
tmp = (salario - tramo[0]) * tramo[2] * (1/100)
else:
tmp = (tramo[1] - tramo[0]) * tramo[2] * (1/100)
t.append(tmp)
irpf = sum(t)
neto = salario - irpf
neto_mensual = neto/pagas
return t, irpf, neto, neto_mensual
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment