CJCoding With Joseph
15free / daySign inCreate account

Ways To Arrange

Complete permutations_count(n: int) -> int so it returns how many different orders n distinct items can be placed in a row: there are n choices for the first spot, and then the remaining items can be arranged in permutations_count(n - 1) ways. The recursive case is written for you; add the missing base case at the top of the body, which returns 1 for n equal to 0 because the empty row counts as exactly one arrangement. Do NOT write a main block or any top-level test code; the tests construct the calls. Input: one integer n, no prompt, which the tests read and pass to your function before printing the value it returns.

Expected Output:

24

= newline. The output ends with a newline — print one after the last line.

Hints2 available
Topics:
Recursion
📥 Auto-Input:
4\n
This input is automatically fed to your program's stdin
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.