Created
October 25, 2022 06:57
-
-
Save alksndrglk/4dc6b10c9f360d1d9d5c3b2b9cc5e66e to your computer and use it in GitHub Desktop.
This file contains 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
def factorial(k): | |
def gen(n): | |
if n == 1: | |
yield 1 | |
else: | |
for u in gen(n - 1): | |
continue | |
yield u * n | |
return next(gen(k)) | |
if __name__ == "__main__": | |
print(factorial(10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment