fork download
  1. def nb_year(p0, percent, aug, p):
  2. years = 0
  3. while p0 < p:
  4. years = years + 1
  5. p0 = p0 + p0 * (percent * .01) + aug
  6. print(p0)
  7. return years
  8.  
  9. print(nb_year(1500, 5, 100, 5000))
Success #stdin #stdout 0.01s 28384KB
stdin
Standard input is empty
stdout
1675.0
1858.75
2051.6875
2254.271875
2466.98546875
2690.3347421875
2924.851479296875
3171.0940532617187
3429.648755924805
3701.1311937210453
3986.1877534070977
4285.497141077452
4599.771998131325
4929.760598037891
5276.248627939785
15