Newer
Older
bth_py_exercises / 1.27 / list_intersection.py
@Pascal Syma Pascal Syma on 2 Sep 2021 437 bytes Completed 1.27
"""
Exercise 1.27  - Intersection
"""


#  Copyright (c) 2021. Pascal Syma. All rights reserved.

def list_intersection(list1, list2):
    """
    Return the intersection between two lists.
    :param list1: First list
    :param list2: Second list
    :return: Intersection
    """
    return [i for i in list1 if i in list2]


if __name__ == '__main__':
    print(f'{list_intersection([1,3,6,78,35,55], [12,24,35,24,88,120,155]) = }')