2. List Overlap

A program that returns a list containing only the common elements between two lists. For example, given the lists [1, 2, 3, 4] and [3, 4, 5, 6], the program should return [3, 4].

image

Solve this code by using ‘in’ functionality in python list

def find_loop_list():
    final_list = []
    list_1 = (input("Enter first list of number ")).split(' ')
    list_2 = (input("Enter second list of number ")).split(' ')

    for l1 in list_1:
        if l1 in list_2:
            final_list.append(int(l1))
    return final_list