Challenge 1
Implement the asynchronous iterator protocol for a counter.
import asyncio
class Counter:
def __init__(self, limit):
self.current = 0
self.limit = limit
async def main():
return [value async for value in Counter(3)]
print(asyncio.run(main()))
Press Ctrl⌘Enter to check your answer