Junior — Senior
Determining the output sequence when using asyncio.gather
livecode
Task condition
Which output will appear first in the console and why?
import asyncio
async def f1():
await asyncio.sleep(1)
print("f1")
async def f2():
for _ in range(1_000_000_000):
pass
print("f2")
async def main():
await asyncio.gather(f1(), f2())
asyncio.run(main())