Find Common Elements in Two Lists

Advanced

In this fun challenge, you will learn to find common elements between two lists.

Let's say we have two lists, and we want to find all the items that are present in both lists.

Your task is to write a Python function, find_common_elements that takes two lists as inputs and returns a new list containing all the items that appear in both lists.

The order of elements in the output list can be in the order they appear in the first list, and there should be no duplicates in the output list.

For example, if the input lists are:

list1 = ['apple', 'banana', 'cherry', 'date'] list2 = ['banana', 'date', 'fig', 'grape']

Then, the function should return:

['banana', 'date']

Another example:

list1 = [1, 2, 3, 4, 5] list2 = [0, 2, 4, 6, 8]

The function will return:

[2, 4]

Ready to make your lists talk to each other? Let's get started!

Geek
Inputs

Arg 1:

["apple","banana","cherry","date"]

Arg 2:

["banana","date","fig","grape"]
Expected Output
["banana", "date"]
Actual Output