input a string and print the words which start and end with vowel
Answers
Answered by
14
The following codes are written in Python.
Source code:
n = input("Enter a string: ")
l = n.split()
print()
print("The words starting and ending with vowels are as follows: ")
for i in l:
if i[0] in "aeiouAEIOU" and i[-1] in "aeiouAEIOU":
print(i)
Once the user inputs the string, it gets split into different elements and is assigned to list 'l'. After that, a loop starts, where the variable 'i' traverses through all the elements and if it fulfils the condition, it gets printed.
Attachments:
Similar questions