Skip to content

Instantly share code, notes, and snippets.

@nilleb
Last active January 3, 2024 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nilleb/0eac011ae58cf250945fed463326ce34 to your computer and use it in GitHub Desktop.
Save nilleb/0eac011ae58cf250945fed463326ce34 to your computer and use it in GitHub Desktop.
Impôts sur le revenu et impôt sur les sociétés, comparaison
baremes = [(0, 10777, 0), (10778, 27478, 11), (27479, 78570, 30), (78571, 168994, 41)]
max_bareme, max_pct = 168995, 45
def impot_revenu(val, nombre_parts=1):
val = val - val * 0.1
val = val / nombre_parts
impot = 0
for min_bareme, max_bareme, pct in baremes:
montant_imposable = max(
(val if val < max_bareme else max_bareme) - min_bareme, 0
)
impot += montant_imposable * pct / 100
if val > max_bareme:
impot += (val - max_bareme) * max_pct / 100
return impot * nombre_parts
def impot_societe(val):
impot = 0
if val > 42000:
impot = (val - 42000) * 0.25
val = 42000
impot += val * 0.15
return impot
for montant in range(1, 21):
montant *= 10000
mir = impot_revenu(montant)
mis = impot_societe(montant)
print(montant, mir, mis, ">" if mis > mir else "<")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment