I am to compare values of dictionary and find if they are congruent like so; If the dict is {'k1':'v2','k2':'v2','k3':'v2'} i want to compare values which are all identical in this case and for python to print Three values are the same The code i am currently using gives me a list of duplicated elements which is no good. CODE:
d1={'k1':'v2','k2':'v2','k3':'v2'}
l=[]
for v in d1.keys():
for c in d1.keys():
if d1[v] == d1[c]:
l.append(c)
if len(l)==0:
print('No keys have same values!')
else:
print(l)
Thanks in advance