Created
February 22, 2022 01:07
-
-
Save marquesds/2496f05063929194d56421f02e26b1cd to your computer and use it in GitHub Desktop.
Fatorial algorith using reduce function
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 functools | |
import operator | |
def fat(n): | |
return functools.reduce(operator.mul, range(1, n + 1), 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment