0 out of 464 challenges solved
Write a Python function `common_element(list1, list2)` that takes two lists as input and returns `True` if they have at least one common element, otherwise returns `False`. #### Example Usage ```python [main.nopy] print(common_element([1, 2, 3, 4, 5], [5, 6, 7, 8, 9])) # Output: True print(common_element([1, 2, 3, 4, 5], [6, 7, 8, 9])) # Output: False print(common_element(['a', 'b', 'c'], ['d', 'b', 'e'])) # Output: True ``` #### Requirements - The function should iterate through the elements of both lists to determine if there is any overlap. - The function should return a boolean value (`True` or `False`).
def common_element(list1, list2): """ Check if two lists have at least one common element. Args: list1 (list): The first list. list2 (list): The second list. Returns: bool: True if there is at least one common element, False otherwise. """ # Placeholder for the solution pass