The following Python function processes text:
def display_vowel_words():
vowels = "AEIOUaeiou"
result = []
with open("Report.txt", "r") as f:
for line in f:
words = line.split()
for word in words:
clean_word = word.strip(".,?!")
if clean_word and clean_word[0] in vowels and clean_word[-1] in vowels:
result.append(clean_word)
print(" ".join(result))
This function initializes a
vowels string. It reads the file
"Report.txt" line by line. Each line is segmented into words using
split(). Punctuation is removed from each word via
strip(".,?!"). The function then verifies if a word commences and concludes with a vowel. Qualifying words are collected in the
result list. Lastly, the collected words are concatenated with spaces and displayed.