Create a function that takes a number num and returns its double factorial. Mathematically, the formulas for double factorial are as follows.
num !! = num ( num - 2)( num - 4)( num - 6) ... (4)(2)
If num == 0
or num == -1
, then num !! == 1
by convention.
double_factorial(0) ➞ 1
double_factorial(2) ➞ 2
double_factorial(9) ➞ 945
double_factorial(14) ➞ 645120
- Assume all input values are greater than or equal to
-1
. - Double factorial is not the same as
factorial * 2
.