word = input(“Enter a phrase”)
def isVowelWorld(word):
word = word.upper()
vowels=“aoeui”
for vowel in vowels:
if vowel not in word:
return False
return True
result = print(isVowelWorld(word))
word = input(“Enter a phrase”)
def isVowelWorld(word):
word = word.upper()
vowels=“aoeui”
for vowel in vowels:
if vowel not in word:
return False
return True
result = print(isVowelWorld(word))
It’s a bit hard to tell without seeing the indentation.
One thing I notice is that you do word = word.upper()
. So for example test
will turn into TEST
, and TEST
doesn’t have any of those lower-case vowels.
Also it looks like you return False
as soon as you see that a certain vowel is not in the word, but maybe you need to check all the vowels.
Vowels are all lower case and word argument will always be converted to upper case so it will never match vowels.
The Loop will exit immediately when you return.
Either remove “upper()” or convert vowels to uppercase.
In your current For loop, iterating on the first vowel in vowels will always return the result immediately and exit the loop.
Invert your IF statement to check if vowel in Word and return True, as the vowel exists in the word and doesn’t matter whether the remainder of the string has vowels because it is true regardless. Return False outside of the For Loop.