New course! Every coder should learn Generative AI!
Try a free lesson+ 1
Factorial of 'n' number using reduce()
3 Answers
+ 4
from functools import reduce
reduce(lambda x, y: x*y, [1,2,3,4])
0
ft.reduce(lambda x,y: x*y, range(1,x+1))
0
Given a number ‘n’, output its factorial using reduce().
input should be 1