Generation

generate functionFri, 17 Feb 2023

Даны списки a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] You also need to return a list that consists of elements common to these two lists and print the result

def common_elements(a, b): return [element for element in set(a) if element in b] a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] common_elements(a, b)

Questions about programming?Chat with your personal AI assistant