0 of 464 solved

Find common elements between two lists

Write a function `find_common_elements(list1, list2)` that returns the values shared by both input lists.

Return each shared value once, in the order it first appears in `list1`.

#### 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