Python dictionary code -


so need write python code getting keys in dictionary unique values. example

my_dict = {4:3, 5:3, 6:4, 9:8} 

the program should print

[6, 9] 

because 3 repeated in values. not know how see if values different , how remove them there no ".remove()" dictionaries. have tried making list of keys , values, trying mutate them in way, have had no luck. thanks

count values collections.counter dict keep keys dict value equal 1 in counter dict.

my_dict = {"4":"3", "5":"3", "6":"4", "9":"8"}   collections import counter  cn = counter(my_dict.itervalues()) print([k k,v in my_dict.iteritems() if cn[v] == 1]) ['6', '9'] 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -