0
For example:
A = {2:5,4:5,7:8,9:8,11:10}
Must return B={11:10}
to remove the repeated values.
0
For example:
A = {2:5,4:5,7:8,9:8,11:10}
Must return B={11:10}
to remove the repeated values.
0
This can be done with a single command as follows:
from collections import Counter
B = {k: A[k] for k in A if Counter(A.values())[A[k]] == 1}
Browser other questions tagged python python-3.x dictionary
You are not signed in. Login or sign up in order to post.
Thanks, it is Beautiful.
– Jimmy