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

Revision Text file

The document outlines a series of functions to be implemented for processing a text file named 'Sample.txt'. These functions include counting specific characters, identifying words based on various criteria, and analyzing lines for specific patterns. Additionally, it includes tasks for counting lines, characters, and words, as well as copying certain lines to a new file.

Uploaded by

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

Revision Text file

The document outlines a series of functions to be implemented for processing a text file named 'Sample.txt'. These functions include counting specific characters, identifying words based on various criteria, and analyzing lines for specific patterns. Additionally, it includes tasks for counting lines, characters, and words, as well as copying certain lines to a new file.

Uploaded by

cyarahtandon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Text file questions:

File Name: Sample.txt


Function name: textFile()

1. Count number of ‘S’ or ‘T’ from a text file.


2. Count number of Vowels, Consonants, Spaces, Digits and Special characters from a text file.

3. Print the words that begin vowel


4. Print the words that begin the H or R
5. Print the words that begin and end with the same characters.
6. Print the words that begin and end with consonant.
7. Print the words that end with a digit
8. Print the three lettered words from a file
9. Print the word that has the letter e in it.
10. Print the words that has more than 5 characters in it.
11. Print the words that has more than 2 ‘t’ letters in it.

12. Count the number of words present in the file.


13. Count the words that begin the K or ‘k’
14. Count the number of ‘this’ present in a file. (THIS, THis, tHIS, all possible combination to be
included)

15. Print the lines that begin with the letter T or W.


16. Print the lines that begin and end with same letter.
17. Print the lines that begin with the word ‘The’.(‘THE’, ‘THe’, ‘ThE’, all possible combination to be
included)
18. Print the lines that has more than 10 words in it.
19. Print the lines that has the characters ‘he’ in it. (‘he’ can be a separate word or can be a part of
word)
20. Print the lines that has the word ‘from’ in it.(from, FROM, FroM, all possible combination to be
included)

21. Count the number of lines present in a file.


22. Count the number of characters present in each line of the file.
Output:
Line 1: 65
Line 2: 42
Line 3: 55
23. Count the number of words present in each line of the file.
Output:
Line 1: 12
Line 2: 8
Line 3: 11
24. Count the number of ‘e’ present in each line.
25. Count the number of ‘the’ words present in each line.

26. Print the words that doesn’t have any vowels in it.
27. Print the lines that has more than 2 ‘is’ word in it.
28. Print the lines that has more than 3 four lettered words.
29.

30. Copy the lines that has the word ‘that’ in it to a new file named “thatword.txt’

You might also like