0
Making factorial definition with *args
# This is the list my_list = [3, 5, 7, 9, 44, 15] # This is logic for result my_result = (3! / 4) + (5! / 6) + (7! / 8) + .......... # How to modify this for the result of my_result?? import math def factorial(*numbers): if numbers: for number in numbers: return math.factorial(number) / (number+1) print(factorial(*my_list))
3 Answers
+ 3
import math
def factorial(*numbers):
my_result=0
if numbers:
for number in numbers:
my_result+=math.factorial(number) / (number+1)
return my_result
print(factorial(*my_list))
+ 1
Abhay thanks mate
+ 1
YAKUP KARAKAĆ đ