Answered step by step
Verified Expert Solution
Question
1 Approved Answer
noun.txt Python Please apple banana kiwi elephant aquamarine anteater iolet orange indigo purple umber Read Words Objectives: Practice file I/O. . Please download the file
noun.txt
Python Please
apple banana kiwi elephant aquamarine anteater iolet orange indigo purple umber Read Words Objectives: Practice file I/O. . Please download the file named nouns.txt to the folder where your program is to reside. You are asked to write a program to read words from the file, and display only those starting with a vowel. In the file, each non-blank line contains exactly one word. First of all, you want to open the file for reading. As long as end of file is not reached, your loop keeps reading words, one line at a time. Within the loop body, you check whether first character of the read word is a vowel; if so, print that word to screen. Finally, don't forget to close the connection to the file. Your program is expected to produce the following displays: apple elephant aquamarine anteater iolet orange indigo umber end_of_file = False fileSource = open('nouns.txt', 'r') # as long as end of file is not reached, we keep reading one line at a timewhile not end_of_file: # 1. read one line from file # 2. if this is an end-of-file line, turn on the flag end_of_file # 3. otherwise, check whether the first character of the line is a vowel 3.1 if so, print the word contained in the line # flileSource.close()Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started