1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
# -*-coding:Latin-1 -*
#Cette application vous permet de calculer votre impôt sur le revenu
import os
os.system("pause")
continuer = True
while continuer:
#On introduit la variable 'conjoint' (vaut 1 ou 0)
conjoint=2
while conjoint == 2:
conjoint = input("Avez-vous un(e) conjoint(e) (o/n) ? ")
if conjoint == "N" or conjoint == "n":
conjoint=0
elif conjoint == "O" or conjoint == "o":
conjoint=1
else:
conjoint=2
continue
os.system("pause")
#On introduit la variable 'enfants' (0 ou plus)
enfants = -1
while enfants < 0:
enfants = input("Combien avez-vous d'enfants? Si aucuns, entrez '0' : ")
try:
enfants = int(enfants)
except ValueError:
print("Saisir un nombre.")
enfants = -1
continue
if enfants < 0:
print("Saisir un nombre à partir de zero.")
os.system("pause")
#On introduit la variable 'parts_qf'
if enfants < 3 :
parts_qf = 1+conjoint+(enfants/2)
print("Vous avez {} parts de quotient familial.".format(parts_qf))
elif enfants >= 3:
parts_qf = 1+conjoint+(enfants-1)
print("Vous avez {} parts de quotient familial.".format(parts_qf))
os.system("pause")
#On introduit la variable 'revenu_imposable'
revenu_imposable = -1
while revenu_imposable < 0:
revenu_imposable = input("Entrez le revenu imposable du foyer fiscal : ")
try :
revenu_imposable = float(revenu_imposable)
except:
print("Saisir un nombre.")
revenu_imposable = -1
continue
if revenu_imposable < 0:
print("Vous ne pouvez entrer un nombre négatif.")
os.system("pause")
#On introduit la variable 'qf'
qf = revenu_imposable/parts_qf
print("Votre quotient familial est de {} euros.".format(qf))
os.system("pause")
#On calcule en fonction du TMI
limite=[150000,70831,26421,11897,5964,0]
tmi=[0.45,0.41,0.3,0.14,0.055,0]
impot=0
if qf > limite[0]:
impot = (tmi[0]*qf)*parts_qf
elif qf > limite[1]:
impot = (tmi[1]*qf)*parts_qf
elif qf > limite[2]:
impot = (tmi[2]*qf)*parts_qf
elif qf > limite[3]:
impot = (tmi[3]*qf)*parts_qf
elif qf > limite[4]:
impot = (tmi[4]*qf)*parts_qf
elif qf >= limite[5]:
impot = (tmi[5]*qf)*parts_qf
impot = impot.__round__()
print("Votre Taux Marginal d'Imposition est de {}%. Vous paierez {} euros d'impôts sur le revenu.".format((impot/qf),impot))
os.system("pause")
#Pour fermer le programme, ou pas
quitter = input("Souhaitez-vous quitter ce programme (o/n) ? ")
if quitter == "O" or quitter == "o":
continuer = False
os.system("pause") |
Partager