Write a program to find out and display common and non common elements in the list using membership operators
lst=[10,11,12,12,13,14,10,10]
s={}
print("All elements of the list are")
for ele in lst:
print(ele)
for ele in lst:
cnt=0
for ele1 in lst:
if(ele==ele1):
cnt=cnt+1
if(cnt>=2):
s[cnt]=ele
# print("Common element is %i" %ele)
print("Common element is",s.values(),"is repeated",s.keys(),"times")
print(s)
lst=[10,11,12,12,13,14,10,10]
s={}
print("All elements of the list are")
for ele in lst:
print(ele)
for ele in lst:
cnt=0
for ele1 in lst:
if(ele==ele1):
cnt=cnt+1
if(cnt>=2):
s[cnt]=ele
# print("Common element is %i" %ele)
print("Common element is",s.values(),"is repeated",s.keys(),"times")
print(s)