The following code must retrun True,True then False and False but it is returning True,False,False and None.help fix this. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

The following code must retrun True,True then False and False but it is returning True,False,False and None.help fix this.

def has_a_vowel(a_str): for letter in a_str: if letter in "aeiou": return True else: return False print("Done!") print(has_a_vowel("abba")) print(has_a_vowel("beeswax")) print(has_a_vowel("syzygy")) print(has_a_vowel(""))

22nd Mar 2019, 2:37 PM
Bikal Shrestha
1 Answer
+ 8
Try this: def has_a_vowel(a_str): for letter in a_str: if letter in "aeiou": return True return False print(has_a_vowel("abba")) print(has_a_vowel("beeswax")) print(has_a_vowel("syzygy")) print(has_a_vowel("")) https://code.sololearn.com/cuH2gx4FQB9K/?ref=app
22nd Mar 2019, 2:45 PM
VEDANG
VEDANG - avatar