DEV Community

loading...

Discussion on: Daily Challenge #271 - Simulate Population Growth

Collapse
highcenburg profile image
Vicente G. Reyes
def nb_year(p0, percent, aug, p,  year = 0):
  if (p0 >= p):
    return year
  else:
    year += 1
    pop = p0 + p0 * (percent/100) + aug
    return nb_year(pop, percent, aug, p, year)