0 out of 464 challenges solved
**Question:** Write a function called partition that takes the arguments `n`, `step`, and `seq` (a number, a number, and a sequence) as input. The function should partition the sequence into sublists of `n` elements, stepping forward `step` steps each time. It should return a list of the sublists. **Example:** Input: partition(3, 2, [1, 2, 3, 4, 5, 6, 7, 8, 9]) Output: [[1, 2, 3], [3, 4, 5], [5, 6, 7], [7, 8, 9]]
def partition(n, step, seq):
"""
Partitions the sequence into sublists of n elements, stepping forward step steps each time.
Args:
n: The number of elements in each sublist.
step: The number of steps to move forward each time.
seq: The input sequence.
Returns:
list: The list of sublists.
"""
# TODO: Implement the partition function
pass