Created
January 6, 2022 17:01
-
-
Save narenaryan/81d5a0b99e65bfb5ce1e2e06e1eee9d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| # A co-routine | |
| async def add(x: int, y: int): | |
| return x + y | |
| # An event loop | |
| loop = asyncio.get_event_loop() | |
| # Pass the co-routine to the loop | |
| result = loop.run_until_complete(add(3, 4)) | |
| print(result) # Prints 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment