Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: Implement a function to find the intersection of two lists.
Answer:

def intersection(list1, list2):

  return list(set(list1) & set(list2))

Example:

intersection([1, 2, 3], [2, 3, 4])  # Output: [2, 3]
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook