Membership checks see if the argument on the left is in the array on the right. So "a" in "abc"
checks if the character "a" is in "abc". while "abc" in "string"
checks if the substring "abc" appears in "string"
To solve your problem, the verbose method would be
def contains_all_the_vowels(x):
vo = 'aeiou'
for c in vo:
if c not in x:
return False
return True
using a list comprehension it may be written
def contains_all_the_vowels(x):
return all([c in x for c in 'aeiou'])
The handy thing about using the list comprehension form is that it is easy to handle the "any vowels" or "all vowels" or "no vowels" cases like this:
def contains_all_the_vowels(x):
occurs = [c in x for c in 'aeiou']
if all(occurs):
return "All vowels found"
if any(occurs):
return "At least one vowel found"
return "No vowels found"