0 out of 68 challenges solved

Find common elements between two lists

Question:
Write a function called find_common_elements that takes two lists as input and returns a new list containing the common elements between the two input lists. Use sets to find the common elements.

Example:
Input:
List 1: [1, 2, 3, 4, 5]
List 2: [4, 5, 6, 7, 8]
Output: [4, 5]

def find_common_elements(list1, list2):
    """
    Finds the common elements between two lists.

    Args:
        list1 (list): The first input list.
        list2 (list): The second input list.

    Returns:
        list: A new list with the common elements.
    """
    # TODO: Implement the find_common_elements function
    pass