Kodewick
Start learning →
Starter←→0 / 100

Ways to line up

#016StarterLoopsNumbers3 min

n people can line up in 1 × 2 × 3 × … × n different orders. Write line_ups(n) to multiply it out with a loop. For n of 0, return 1.

Examples
line_ups(3)→6
line_ups(5)→120
main.py
def line_ups(n):
    ways = 1
    for i in range(1, n + 1):
        # your code here: multiply ways by i
        pass
    return ways
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.