Challenge 1
Define the function as a coroutine function.
import asyncio
print(asyncio.run(main()))
Press Ctrl⌘Enter to check your answer
Practice defining coroutine functions, awaiting other coroutines, and running an async entry point.
Challenge 1
import asyncio
print(asyncio.run(main()))
Press Ctrl⌘Enter to check your answer
Challenge 2
async def get_value():
return 21
async def main():
value =
return value * 2
import asyncio
print(asyncio.run(main()))
Press Ctrl⌘Enter to check your answer
Challenge 3
async def greeting():
return "Hello"
async def main():
message =
return message + ", world!"
import asyncio
print(asyncio.run(main()))
Press Ctrl⌘Enter to check your answer
Challenge 4
import asyncio
async def main():
return 42
print()
Press Ctrl⌘Enter to check your answer