I have two dictionary corresponding to character counts of two different strings. I want to check if they are made up of same characters or not, regardless of the frequencies of the characters.
Say, I have two strings caars and racs
They are made up of same characters a,c,r,s
I know of cmp method to compare two dictionaries, which also compares both the key-value pairs. But I don’t want to compare their values or counts.
Just in case, you may ask, why do I have dict then for both the strings. Well, I do need them in some other part of the problem. So, why not use them.
How can I do this in python quickly?
You want to use a
set.