Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Created December 29, 2023 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephengruppetta/f27681162e975c85356548398c9d6fe0 to your computer and use it in GitHub Desktop.
Save stephengruppetta/f27681162e975c85356548398c9d6fe0 to your computer and use it in GitHub Desktop.
def get_years(start_year):
"""
Create infinite years generator, starting from 'year'
"""
year = start_year
while True:
year += 1
yield year
years = get_years(2023)
print(f"It's time to welcome {next(years)}!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment