22. Problem to get a list of words which has vowels in string.

In this program, we will take a user input as a string and convert it into a list. To check for words that have vowels in string with the help of the below-given steps.

Words which has vowels in string:

Steps to solve the program
  1. Take a string as input.
  2. Split the given string using split() and create an empty list.
  3. Using for loop and if statement check whether a word in the splitter string contains any vowels.
  4. If it has any vowels then add that word to the empty list.
  5. Print the list to see the words which has vowels in string.
				
					#Input string
string = "www Student ppp are qqqq learning Python vvv"

#Splitting a atring
string2 = string.split()

#Creating an empty list
list1 = []

for words in string2:
    for char in words:
    #Checking for vowels
        if char == "a" or char == "e" or char == "i"
        or char == "o" or char == "u":
            list1.append(words)
            break
            
#Printing output 
print(list1)
				
			

Output :

				
					['Student', 'are', 'learning', 'Python']
				
			

Related Articles

Check whether the list is palindrome or not

Add two lists using extend method

Leave a Comment