0 out of 464 challenges solved
Write a Python function `remove_kth_element(lst, k)` that takes a list `lst` and an integer `k` (1-based index) and returns a new list with the k'th element removed. If `k` is out of bounds, return the original list. #### Example Usage ```python [main.nopy] remove_kth_element([1, 2, 3, 4, 5], 3) # Output: [1, 2, 4, 5] remove_kth_element([10, 20, 30], 1) # Output: [20, 30] remove_kth_element([7, 8, 9], 5) # Output: [7, 8, 9] ```
def remove_kth_element(lst, k): """ Remove the k'th element from the list. Args: lst (list): The input list. k (int): The 1-based index of the element to remove. Returns: list: A new list with the k'th element removed. """ # Check if k is within the valid range # Implement the logic to remove the k'th element pass