You are on page 1of 1

Assignment on Data File Handling using Text Files

Write the Python Programs for the following with Output.


Programs related to read data from text files:
Read a text file and perform the following on Characters:
1. Count the number of characters excluding spaces.
2. Count upper and lower characters separately excluding spaces.
3. Count numbers, symbols and spaces separately.
4. Count number of vowels and consonants separately.

Read a text file and perform the following on Words:


5. Count the number of words.
6. Count the number of ‘is’ word.
7. Count the number of words starting with ‘a’.
8. Count the number of words ending with ‘s’.
9. Count the number of words starting with ‘the’.
10.Count the number of words ending with ‘big’.
11.Display those words which are less than 4 characters.
12.Display words with number of characters in each word.
13.Display words with number of vowels and consonants in each word.
14.Display the word which has maximum number of vowels.
15.Display the word which has maximum characters.
16.Display the word which has minimum characters.
17.Display each word separated by a (#).

Read a text file and perform the following on Lines:


18.Count number of lines.
19.Count number of lines starting with ‘t’.
20.Count number of lines ending with ‘y’.
21.Count the number of lines starting with ‘they’.
22.Count the number of lines ending with ‘free’.
23.Write code to print just the last line.
Programs related to write data to text files:
24.Write a program to take the details (title and price) of book from the user and write
the record in text file.
Programs related to append data to text files:
25.Write a program to take the details (title and price) of book from the user and write
the record in the end of the text file.

You might also like