Checking if two strings contain the same characters, not considering their frequencies
python
Solution
You want to use a `set`.
In [32]: str1 = 'caars'
In [33]: str2 = 'rats'
In [34]: set(str1) == set(str2)
Out[34]: False
In [35]: str3 = 'racs'
In [36]: set(str1) == set(str3)
Out[36]: True
Problem
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?