0 out of 464 challenges solved

Split List by Step

Write a function `list_split` that takes in a list `S` and an integer `step`. The function should split the list into sublists, where each sublist contains every `step`-th element starting from a different initial offset (0 through `step-1`).

#### Example Usage
```python [main.nopy]
list_split(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n'], 3)
# Expected output: [['a', 'd', 'g', 'j', 'm'], ['b', 'e', 'h', 'k', 'n'], ['c', 'f', 'i', 'l']]

list_split([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], 3)
# Expected output: [[1, 4, 7, 10, 13], [2, 5, 8, 11, 14], [3, 6, 9, 12]]

list_split(['python', 'java', 'C', 'C++', 'DBMS', 'SQL'], 2)
# Expected output: [['python', 'C', 'DBMS'], ['java', 'C++', 'SQL']]
```
def list_split(S, step):
    """
    Splits the list S into sublists, where each sublist contains every step-th element.

    Args:
        S (list): The input list to be split.
        step (int): The step value for splitting.

    Returns:
        list: A list of sublists.
    """
    # Placeholder for the solution
    pass