This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastapi import FastAPI | |
app = FastAPI() | |
@app.get('/') | |
def hello(): | |
return {"message": "Hello World!"} | |
@app.get('/simulation') | |
def simulation(years: int, capital: float, ir: float): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def annuite(interest_rate, years, capital): | |
return (capital * interest_rate)/(1 - (1+interest_rate)**-years) | |
def tableau_amortissement(years, capital, interest_rate): | |
a = float(format(annuite(interest_rate, years, capital), '.2f')) | |
capital_debut_periode = capital | |
print("Annuité du prêt: " + str(a)) | |
for i in range(years): |