Professional Documents
Culture Documents
Important Text File Handling Question
Important Text File Handling Question
Q1. Write a user defined function countwords() in python to count how many words are
present in a text file named “story.txt”. For example, if the file story.txt contains following text:
Co-education system is necessary for a balanced society. With co-education system, Girls and
Boys may develop a feeling of mutual respect towards each other.
Q2. Write a user defined function in Python that displays the number of lines starting with ‘H’
in the file story.txt. Eg: if the file contains:
My first book was Me and My Family. It gave me chance to be Known to the world.
Q4. Write a method/function DISPLAYWORDS() in python to read lines from a text file
STORY.TXT, and display those words, which are less than 4 characters.
Q5. Write a function in python to count the number of lowercase alphabets present in a text
file “Story.txt”