Source Code:
(back to article)
# Using List Comprehension search_element = 3 print([i for i in my_list if i == search_element]) # Using filter result = list(filter(lambda x: x == search_element, my_list)) print(result)
Result:
Report an issue