0 out of 464 challenges solved
Write a Python function `split_two_parts` that takes in a list and an integer `L`. The function should split the given list into two parts where the length of the first part of the list is `L`, and return the resulting lists in a tuple. If `L` is greater than the length of the list, the first part should contain the entire list, and the second part should be empty. If `L` is less than or equal to zero, the first part should be empty, and the second part should contain the entire list. #### Example Usage ```python [main.nopy] split_two_parts([1, 2, 3, 4, 5], 3) # Returns ([1, 2, 3], [4, 5]) split_two_parts(['a', 'b', 'c', 'd'], 2) # Returns (['a', 'b'], ['c', 'd']) split_two_parts([1, 2, 3], 0) # Returns ([], [1, 2, 3]) split_two_parts([1, 2, 3], 5) # Returns ([1, 2, 3], []) ```
def split_two_parts(input_list, L): """ Splits the input list into two parts based on the given length L. Args: input_list (list): The list to be split. L (int): The length of the first part. Returns: tuple: A tuple containing two lists. """ # Implement the function logic here pass