Friday, 3 April 2020

ASSIGNMENT ON FILE HANDLING


             

SUBJECT: COMPUTER SCIENCE

ASSIGNMENT-1
TOPIC: FILE HANDLING

    1.     A text file named computer.txt contains some text which needs to be displayed such that every next character is separated by a symbol #. Write a program to do this.
    2.     WAP in python to open a text file story.txt so that new contents can be added at the end of file in it.
    3.     WAP to read lines from the text file india.txt and to find and display the occurrence of the word “India”.
If the content of the file is:
India is the fastest growing economy.
India is looking for more investments around the globe.
The whole world is looking at India as a great market
Most of the Indians can foresee the heights that India is capable of reaching.
The output should be : 4

   4.     WAP to read the file story.txt and count the number of lines that begins with ‘A’ or ‘E’.
   5.     WAP to read the file book.txt and copy all its contents to author.txt.
   6.     WAP to read the file book.txt and count total number of alphabets and digits.
   7.     WAP to find the longest word in the file story.txt.
   8.     WAP to count total no. of spaces, words, characters and lines in the file message.txt.
   9.      Differentiate between file modes r+ and rb+ with respect o python.
   10.                         Differentiate between text file and binary file.

No comments:

Post a Comment