0% found this document useful (0 votes)
70 views

Text Files Questions - 2

The document provides 10 tasks to write Python functions that analyze text files. The functions include counting vowels, lines starting with certain letters, words of certain lengths, and occurrences of specific words. The functions are to read text from files like "Alpha.txt", "Poem.txt", "Country.txt", and "para.txt" and display results of the analyses.

Uploaded by

dummycat2022
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Text Files Questions - 2

The document provides 10 tasks to write Python functions that analyze text files. The functions include counting vowels, lines starting with certain letters, words of certain lengths, and occurrences of specific words. The functions are to read text from files like "Alpha.txt", "Poem.txt", "Country.txt", and "para.txt" and display results of the analyses.

Uploaded by

dummycat2022
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

TEXTFILE REVISION-1

1 Write a function in Python to read a text file, Alpha.txt and 3


displays those lines which begin with the word ‘You’.
OR
Write a function, vowelCount() in Python that counts and
displays the number of vowels in the text file named
Poem.txt.
2 Write a function in python to count the number lines in a text 3
file ‘Country.txt’ which is starting with an alphabet ‘W’ or ‘H’.
3 Write a function in python to read lines from file “POEM.txt” 3
and display all those words, which has two characters in it.
4 Write a function to display those lines which start with the 2
letter “G” from the text file “MyNotes.txt”
5 Write a function COUNT() in Python to read contents from file
“REPEATED.TXT”, to count and display the occurrence of the
word “Catholic” or “mother”.
6 Write a function VowelCount() in Python, which should read
each character of a text file MY_TEXT_FILE.TXT, should count
and display the occurrence of alphabets vowels.
7 Write the difference between text file and binary file.
8 Write a function countdigits() in python to count no.of digits
in “number.txt”.Count and display the count.
9 Write a function that counts and display the number of 5
letter words in a text file “Sample.txt
10 Write a function in python that displays the number of lines
starting with ‘H’ in the file “para.txt”.

You might also like