Generator function with yield
Section: Comprehensions and generators
Generator function with yield
python
python
def countdown(n: int):
while n > 0:
yield n
n -= 1Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Comprehensions and generators