¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita+ 1
Factorial of 'n' number using reduce()
3 Respuestas
+ 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