Created
November 5, 2016 01:36
-
-
Save renzon/5b75efa1626f58b7ab69f6a77bf7b673 to your computer and use it in GitHub Desktop.
find itens which has odd frequency
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 | |
def find_odds(seq): | |
return [k for k, v in Counter(seq).items() if v % 2 == 1] | |
print(find_odds([20, 1, -1, 2, -2, 3, 3, 5, 5, 1, 2, 4, 20, 4, -1, -2, 5])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using set only: