0% found this document useful (0 votes)
3 views2 pages

Text File Operations

The document outlines several Python functions for text file operations. These include displaying words starting and ending with a vowel, lines ending with a dot, the line with the maximum number of vowels, words longer than five characters, lines starting with 'K' or 'R', and displaying sentences from a text file. Each function is designed to process specific text files and produce formatted outputs based on the given criteria.

Uploaded by

s.monishass21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Text File Operations

The document outlines several Python functions for text file operations. These include displaying words starting and ending with a vowel, lines ending with a dot, the line with the maximum number of vowels, words longer than five characters, lines starting with 'K' or 'R', and displaying sentences from a text file. Each function is designed to process specific text files and produce formatted outputs based on the given criteria.

Uploaded by

s.monishass21
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Text File Operations

[Link] a Python function that displays all the words starting


and ending with a vowel from a text file "[Link]". 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 a awesome able

[Link] a Python function that displays all the lines ending with a
dot (.) from a text file "[Link]". For example, if the file contains
:

White is a mix of seven colors.


What are these seven colors ?
VIBGYOR – violet, indigo, blue, green, orange and red.
When we mix all these colors we just get one light
which is the WHITE light.

Then the output should be :


White is a mix of seven colors.
VIBGYOR – violet, indigo, blue, green, orange and red.
which is the WHITE light.

3. Write a function in Python to display the line which has the


maximum number of vowels from a text file, "[Link]".

[Link] a Python function that finds and displays all the


words longer than 5 characters from a text file "[Link]".

[Link] a Method with name Display() in Python which


display those lines which either start with letter “K” or Letter
“R”.

[Link] a user defined function in Python named


showInLines() which reads contents of a text file named
[Link] and displays every sentence in a separate line.

Assume that a sentence ends with a full stop (.), a question


mark (?), or an exclamation mark (!).For example, if the content of
file [Link] is as follows:
Our parents told us that we must eat vegetables to be healthy. And it
turns out, our parents were right! So, what else did our parents tell?

Then the function should display the file's content as follows:


Our parents told us that we must eat vegetables to be healthy.
And it turns out, our parents were right!
So, what else did our parents tell?

You might also like