0 out of 464 challenges solved
Write a Python function `check_consecutive(lst)` that checks whether the given list contains consecutive numbers or not. A list is considered to have consecutive numbers if all the numbers in the list can be arranged in a sequence where each number is exactly one greater than the previous one. #### Function Signature ```python [main.nopy] def check_consecutive(lst: list) -> bool: ``` #### Input - `lst`: A list of integers. #### Output - Returns `True` if the list contains consecutive numbers, otherwise `False`. #### Examples ```python [main.nopy] check_consecutive([1, 2, 3, 4, 5]) # Output: True check_consecutive([1, 2, 4, 5]) # Output: False check_consecutive([3, 2, 1]) # Output: True check_consecutive([1, 1, 2]) # Output: False ```
def check_consecutive(lst: list) -> bool: """ Check if the given list contains consecutive numbers. Args: lst (list): A list of integers. Returns: bool: True if the list contains consecutive numbers, False otherwise. """ # Your code here pass