Find the intersection of two lists #
Write a function find_intersection(list1, list2) that takes two lists as input and returns a new list containing the intersection of the two input lists. The intersection is defined as the common elements that appear in both lists.
Tests #
find_intersection([1, 2, 3, 4, 5], [4, 5, 6, 7, 8])should return[4, 5]find_intersection([9, 10, 11], [6, 7, 8])should return[]find_intersection([1, 2, 3], [1, 2, 3])should return[1, 2, 3]
Getting Started with Python
Data Types
Python Functions
Statements in Python
Basic Debugging in Python
Basic Algorithm
Object-Oriented Programming
Error Handling
Intermediate Algorithm
Python Modules