← Back to Recursion
Question 598
Ways To Arrange
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
Sign in to use hintsTopics:
Recursion
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.