Loading...
Loading...
Loading...
A scheduling tool counts the different orders in which n tasks can be done. That number is n factorial, written n!, which is 1 × 2 × ... × n. By definition 0! is 1.
Given n, print n!.
Example
Input
5
Output
120
1 × 2 × 3 × 4 × 5 = 120.
Try the problem first. Open one hint at a time.
Start a product at 1 and multiply it by each number.
For n = 0 or 1 the loop should not change the product.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor