Computer Science, asked by samsmohanty4, 2 days ago

Write a Python function that accepts two lists and returns the common elements in these two lists. If there are no common elements, then an appropriate message should be displayed​

Answers

Answered by dv855117
2

Answer:list1 = [1, 2]

list2 = [1, 3]

list1_as_set = set(list1)

intersection = list1_as_set. intersection(list2) Find common elements of set and list.

intersection_as_list = list(intersection)

print(intersection_as_list)

Explanation:

Similar questions