Guest User

Untitled

a guest
Oct 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. def payment(balance, annualInterestRate, monthlyPaymentRate):
  2. month = 0
  3. monthlyInterestRate = annualInterestRate/12
  4.  
  5. # Tant que l'année n'est pas terminé et que la balance est plus grande que 0.
  6. while month < 12 and balance > 0:
  7. # On soustrait les paiements mensuels de la balance.
  8. balance -= (monthlyPaymentRate*balance)
  9. # On rajoute les intérets à la balance.
  10. balance += (monthlyInterestRate*balance)
  11. month += 1
  12. # On arrondit le solde à 2 décimales.
  13. return round(balance, 2)
  14.  
  15. print("Remaining balance: ", payment(balance, annualInterestRate, monthlyPaymentRate))
Add Comment
Please, Sign In to add comment