from array import array taux = array('d', [0., 0.055, 0.14, 0.3, 0.41, 0.45]) tranches = array('d', [0., 6011, 11991, 26631, 71397, 151200]) quotient = float(input("Quotient familial : ")) impot = 0. i = 1 while i < len(tranches) and quotient >= 0 : quotient -= (tranches[i] - tranches[i-1]) if quotient >= 0 : impot += quotient * (taux[i] - taux[i-1]) i += 1 print ("Impot = " + str(impot))