How to convert counter elements to a set in Python

1 Answer

0 votes
from collections import Counter

counter = Counter()
for ch in "python programming":
    counter[ch] += 1

print(set(counter))



'''
run:

{'n', 'r', 'p', 'i', 'y', 'o', 'm', 'a', 'h', ' ', 't', 'g'}
 
'''

 



answered Jul 26, 2019 by avibootz

Related questions

1 answer 180 views
1 answer 143 views
1 answer 177 views
2 answers 229 views
1 answer 159 views
...