How to write common elements in two lists in python
list1 = [1,2,3,4,5]
list2 = [3,4,5,6,10,8]
commom_elements = []
for elements in list1:
if elements in list2:
commom_elements.append(elements)
print("The common elements are:",commom_elements)
Comments
Post a Comment