Comparing values of counter in python 3.3

Amjad Syed amjadcsu at gmail.com
Thu Dec 12 02:49:09 EST 2013


Hello,

I have 2 counters generated from list using  Collections.counter()

I want to print only key,values in Counter2 which have values > then corresponding value in Counter1.

E.g
Counter1={97:1,99:2,196:2,198:1}
Counter2={97:1 ,99:3, 196:1,198:1}

# Output
[99,3]
# Need to compare values of counter and reject in function/routine in value in counter2 is higher then value in counter1 for a current key


Thanks



More information about the Python-list mailing list