Last active
August 4, 2022 14:16
-
-
Save woosungchu/62aa2a3db8a8d93abcf92c501d69a886 to your computer and use it in GitHub Desktop.
Do you think you know recursive function and asyncio?
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 | |
import time | |
def recur(depth): | |
depth -= 1 | |
print('recursion in', depth) | |
for ea in [1,2,3,4,5]: | |
if depth>0: | |
recur(depth) | |
def main(): | |
recur(8) | |
start = time.time() | |
print(f'Time: {time.time() - start:.2f}') | |
main() | |
end = time.time() | |
print(f'Time: {end-start:.2f} sec') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it will cost 10 seconds