Evaluating Factorials

Published by Joshua Señoron in

Create a function that takes a list of factorial expressions and returns the sum.

Examples

eval_factorial(["2!", "3!"]) ➞ 8

eval_factorial(["5!", "4!", "2!"]) ➞ 146

eval_factorial(["0!", "1!"]) ➞ 2

Notes

0! and 1! both equal 1.

Watch a quick demo on how Edabit works.