Skip to content

Instantly share code, notes, and snippets.

@gonzalodiaz
Last active June 6, 2020 09:19
Show Gist options
  • Save gonzalodiaz/2fc216bc03b23866b9621cedfaa6aef4 to your computer and use it in GitHub Desktop.
Save gonzalodiaz/2fc216bc03b23866b9621cedfaa6aef4 to your computer and use it in GitHub Desktop.
PopulationFix
def population(self, year: int) -> int:
"""Obtain the population in the world for a given year.
:param year: Year of which the population wants to be known.
:returns: Population for that year. 0 if the year was not found.
"""
return self.yearly_population.get(year, 0)
def population_on_2020(self) -> int:
"""Obtain the population for 2020.
:returns: population for the year 2020.
"""
return self.population(2020)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment