Do all chars of a string belong to a set?
python, set
Solution
>>> set("aeiou").issuperset("hello world")
False
>>> set("aeiou").issuperset("eoo")
True
Problem
Is there a straightforward way of finding whether all characters of a string belong to a given set of characters? I have the following looping code that I feel can be shortened: ``` def allInSet(mystr, myset): result = True for char in mystr: result &= (char in myset) return result ``` Examples: ``` >>> allInSet("yyyow", set(['a','e','i','o','u','w','y'])) True >>> allInSet("yowza", set(['a','e','i','o','u','w','y'])) False ``` also, `list(mystr) in set(['a','b','c'])` did not work.