0 out of 464 challenges solved

Check Sublist in List

Write a Python function `is_sublist(main_list, sub_list)` that checks whether `sub_list` is a sublist of `main_list`. A sublist is defined as a sequence of elements that appear in the same order in the main list, without any gaps.

#### Function Signature
```python [main.nopy]
def is_sublist(main_list: list, sub_list: list) -> bool:
    pass
```

#### Input
- `main_list`: A list of elements (e.g., integers, strings, etc.).
- `sub_list`: A list of elements to check as a sublist.

#### Output
- Returns `True` if `sub_list` is a sublist of `main_list`, otherwise `False`.

#### Example Usage
```python [main.nopy]
is_sublist([1, 2, 3, 4], [2, 3])  # True
is_sublist([1, 2, 3, 4], [3, 2])  # False
is_sublist([1, 2, 3, 4], [5])     # False
is_sublist([1, 2, 3, 4], [])      # True
```
def is_sublist(main_list: list, sub_list: list) -> bool:
    """
    Check if sub_list is a sublist of main_list.

    Args:
        main_list (list): The main list to check within.
        sub_list (list): The list to check as a sublist.

    Returns:
        bool: True if sub_list is a sublist of main_list, False otherwise.
    """
    # Placeholder for the solution
    pass