Ask the user for a string of all lowercase letters. Tell them whether or not the string contains a lowercase vowel somewhere using the in keyword.

Here’s what your program should look like when you run it:

Enter a string of lowercase letters: abcde
Contains a lowercase vowel!
Or:

Enter a string of lowercase letters: bcd
Doesn't contain a lowercase vowel.

Respuesta :

Answer:

if __name__ == '__main__':

   print("Enter a string of lowercase letters:")

   s = input()

   v = {'a', 'e', 'i', 'o', 'u', 'y'}

   contains = False

   # check every char in string s

   for char in s:

       # check if it contains a lowercase vowel

       if char in v:

           contains = True

           break

   if contains:

       print("Contains a lowercase vowel!")

   else:

       print("Doesn't contain a lowercase vowel.")

ACCESS MORE