26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
from tabulate import tabulate
|
|
|
|
from inflation import get_inflation_data
|
|
from smic import get_smic_data
|
|
|
|
start_year: str = input("année de depart: ")
|
|
stop_year: str = input("année de de fin: ")
|
|
|
|
total_inflation = 1
|
|
inflation_data = get_inflation_data()
|
|
smic_data = get_smic_data()
|
|
|
|
data: list[list[str]] = []
|
|
|
|
for current_year in range(int(start_year), int(stop_year) + 1):
|
|
year: str = str(current_year)
|
|
inflation: float = inflation_data.get(year)
|
|
smic: float = smic_data.get(year)
|
|
data.append([year, str(smic), str(inflation), str(total_inflation * (1 + inflation)), f"{total_inflation} * (1 + {inflation})"])
|
|
total_inflation: float = total_inflation * (1 + inflation)
|
|
|
|
head: list[str] = ["année actuelle", "smic", "inflation", "inflation depuis année de depart", "calcul"]
|
|
|
|
print(tabulate(data, headers=head, tablefmt="grid"))
|
|
print(f"augmentation du smic: +{round((smic_data.get(stop_year) - smic_data.get(start_year)) * 100 / smic_data.get(start_year), 2)}%")
|
|
print(f"produit de l'inflation: +{round((total_inflation - 1) * 100, 2)}%") |