0% found this document useful (0 votes)
3 views2 pages

2.practice Programs Files

The document outlines four programming tasks related to file operations. These tasks include reading, writing, and appending to files, counting lines, extracting unique words, and copying contents between files. Additionally, it includes counting vowels in a file and lines starting with a specific letter.

Uploaded by

yashshiv2006
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)
3 views2 pages

2.practice Programs Files

The document outlines four programming tasks related to file operations. These tasks include reading, writing, and appending to files, counting lines, extracting unique words, and copying contents between files. Additionally, it includes counting vowels in a file and lines starting with a specific letter.

Uploaded by

yashshiv2006
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

1. Write a program to perform read, write and append operation on a file.

Also, count the Number of Lines in


a File.

• Note: readlines() stores each line as a list element.


Example:
['First line\n', 'Second line\n', 'File handling is easy\n', 'Fourth line added later\n']
That’s why len function is used to count total elements in List.
2. Write a program that inputs a text file. The program should print all of the unique words in the file in
alphabetical order. Write a function to count number of lines which start from ‘F’.

3. Scenario: You have a file ([Link]) that contains employee data, and you want to read from it and append
it to another file [Link].
WAP to copy contents of [Link] to [Link].

4. WAP to to count Vowels in a File.

You might also like