# Create an empty list of common elements
common_elems = []

# Iterate over the lists
for element in list1:
    # Check if the element is present in the second list
    if element in list2:
        # Add the element to the list of common elements
        common_elems.append(element)

# Print the common elements
print(common_elems)

# Output: [2, 4]
list1 = [1, 2, 3, 4] 
list2 = [2, 5, 4, 6]
Crea un algoritmo per confrontare due liste e trovare tutti gli elementi simili.