Advertisements
Advertisements
Question
Write a Python function that displays all the words starting and ending with a vowel from a text file “Report.txt”. The consecutive words should be separated by a space in the output. For example, if the file contains:
Once there was a wise man in a village.
He was an awesome story-teller.
He was able to keep people anchored while listening to him.
Then the output should be:
Once a awesome able.
Code Writing
Advertisements
Solution
def votvowele():
f = open("Report.txt")
slst = f.readlines()
for line in slst:
wordlst = line.split(")
for w in wordlst:
if w[0] in "aeiouAEIOU" and w[-1] in "aeiouAEIOU":
print(w," ")
shaalaa.com
Is there an error in this question or solution?
