Loading Skulpt Python Interpreter...

Loading from jsDelivr CDN. This should be fast and reliable.

First Factorial

Easy
Math
Acceptance: 91.5%

Have the function FirstFactorial(num) take the num parameter being passed and return the factorial of it. For example: if num = 4, then your program should return (4 * 3 * 2 * 1) = 24. For the test cases, the range will be between 1 and 18 and the input will always be an integer.

Examples

Example 1:

Input:4
Output:24
Explanation:4! = 4 × 3 × 2 × 1 = 24

Example 2:

Input:8
Output:40320
Explanation:8! = 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 40320

Example 3:

Input:1
Output:1
Explanation:1! = 1 (by definition)

Constraints

  • 1 <= num <= 18
  • num will always be an integer
  • Return the factorial as an integer
  • 0! and 1! both equal 1

Code Editor

python