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))

23rd Sep 2020, 4:08 PM
YAKUP KARAKAƞ
YAKUP KARAKAƞ - avatar
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))
23rd Sep 2020, 4:14 PM
Abhay
Abhay - avatar
+ 1
Abhay thanks mate
23rd Sep 2020, 4:55 PM
YAKUP KARAKAƞ
YAKUP KARAKAƞ - avatar
+ 1
23rd Sep 2020, 7:22 PM
Abhay
Abhay - avatar