def calculer_Floor(montant_emprunt, taux_plancher, tx_prime, hypotheses): # Calcul de la prime prime = tx_prime * montant_emprunt print("\nCalcul de la prime: {:.2%} * {:.2f} € = {:.2f} €".format(tx_prime, montant_emprunt, prime)) # Traitement de chaque hypothèse for i, tam in enumerate(hypotheses, 1): print("\nHypothèse {} - TAM: {:.2%}".format(i, tam)) print("Prime payée en début de période: {:.2f} €".format(prime)) if tam < taux_plancher: differentiel = montant_emprunt * (taux_plancher - tam) print("Exercice de l'option car TAM < Taux plancher garanti") print("Différentiel reçu: {:.2f} €".format(differentiel)) print("Calcul du différentiel: {:.2f} € * ({:.2%} - {:.2%}) = {:.2f} €".format(montant_emprunt, taux_plancher, tam, differentiel)) else: print("Aucun différentiel reçu car TAM >= Taux plancher garanti") # Paramètres d'entrée montant_emprunt = float(input("Montant de l'emprunt : ")) taux_plancher = float(input("Taux plancher garanti (%) : ")) / 100 # Conversion en pourcentage tx_prime = float(input("Taux de la prime (%) : ")) / 100 # Conversion en pourcentage nombre_hypotheses = int(input("Nombre d'hypothèses : ")) hypotheses = [] for _ in range(nombre_hypotheses): tam = float(input("Taux d'intérêt variable (TAM) pour l'hypothèse (%) : ")) / 100 # Conversion en pourcentage hypotheses.append(tam) # Exécution du calcul calculer_Floor(montant_emprunt, taux_plancher, tx_prime, hypotheses)