← Back to challenges

Evaluating Factorials

PythonHardstringsformattingnumbersmath

Instructions

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.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Returning an "Add" Function