Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribednoun.txt

image text in transcribed

image text in transcribedPython 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial Databases 2nd Symposium Ssd 91 Zurich Switzerland August 1991 Proceedings Lncs 525

Authors: Oliver Gunther ,Hans-Jorg Schek

1st Edition

3540544143, 978-3540544142

More Books

Students also viewed these Databases questions