arr = [1,2,2,3,3,3]
dic={}
for i in arr:
if i in dic:
dic[i]+=1
else:
dic[i]=1
print(dic)
lis=[]
for key,val in dic.items():
if key==val:
lis.append(key)
print((lis))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter