Resolved: Write a function factorial_list(Arr) in Python, which accepts a list Arr of numbers and return the list of factorial of each value 0 By Isaac Tonny on 17/06/2022 Issue Share Facebook Twitter LinkedIn Question: Output Example:- Sample Input Data of the list: Arr= [1,2,3,4,5] Sample Output Data in the List: Op = [1,2,6,24,120] Edit*= sorry forgot to give what have i done so far:- def factorial_list(Arr): for item in Arr: fact = 1 for number in range(1,item+1): fact = fact * number print ("Factorial of", item, "is", fact) l1=eval(input("Enter List: ")) factorial_list(l1) here is my output: Enter List: [1,2,3,4,5] Factorial of 5 is 1 Factorial of 5 is 2 Factorial of 5 is 6 Factorial of 5 is 24 Factorial of 5 is 120 which is not my desired output what should I do to get it in my list form?? Answer: import math def factorial_list(Arr): ret = [] for el in Arr: ret.append(math.factorial(el)) return ret l1=eval(input("Enter List: ")) print('Factorials:', factorial_list(l1)) Output: Enter List: [1, 2, 3, 4, 5] Factorials: [1, 2, 6, 24, 120] Edit (suggested by Daniel Hao): To make this more efficient, we could use a list comprehension in the factorial_list function: def factorial_list(Arr): return [math.factorial(el) for el in Arr] l1=eval(input("Enter List: ")) print('Factorials:', factorial_list(l1)) If you have better answer, please add a comment about this, thank you! python