-
-
Save IndhumathyChelliah/ce00e45053e1a077b0e2789d16d0d10c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import Counter | |
#Unary addition removes zero and negative count | |
c=Counter({'a':1,'b':2,'c':-5}) | |
print (+c)#Output:Counter({'b': 2, 'a': 1}) | |
#unary subtraction | |
c1=Counter({'a':1,'b':2,'c':-5}) | |
print (-c)#Output:Counter({'c': 5}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment