File Handling-text Files
File Handling-text Files
2. Write a program that reads and display all of the numbers stored in
the file numbers.txt (created in question 1) and calculates their total.
3. Write a function, digit_count() in Python that counts and displays the
number of digits in the text file named 'sample.txt'. For example, if the
content of 'sample.txt' is as follows :
4. Write a function lines_count() that reads lines from a text file named
'zen.txt' and displays the lines that begin with any vowel. Assume the
file contains the following text and already exists on the computer's
disk:
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
5. Assume that the file 'notes.txt' containing some text and exists on the
computer’s disk. Write a program that display only those words from
'notes.txt' file whose length is more than seven. Keep in mind that any
punctuation marks at the beginning or end of a word should also be
considered as part of the word's length.
6. Write a function last_digit_words() in Python to count the words
ending with a digit in a text file "notes.txt". For example, if the file
content is as follows :
11. Write a function in python to read the content from a text file
"poem.txt" line by line and display the same on screen.
12. Write a function in python to count the number of lines from a
text file "story.txt" which is not starting with an alphabet "T".
13. Write a function in Python to count and display the total number of
file "story.txt", and display those words, which are less than 4
characters.
15. Write a function AMCount() in Python, which should read each