Uploaded by Pranav Gupta

COMPUTER SCIENCE H.H.W.

advertisement
C.S. H.H.W.
Question1:
WAP to create a text file and copy its content to another text file.
Ans:
CODE
My.txt
Output.txt
Question2:
WAP that reads a text file and creates another file that is identical
except that every sequence of consecutive blank spaces is replaced
by a single space.
Ans:
CODE
myfile1.txt
myfile2.txt
Question3:
A file sports.dat contains information in the following format:
Event – Participant
Write a function that would read contents from the file sports.dat
and creates a file atheletic.dat copying only those records from
sports.dat where the event name is “Athletics”.
Ans:
CODE
Question4:
WAP to count the words “to” and “the” present in text file.
Ans:
CODE
Myfile1.txt
Output
Question5:
WAP to count the number of uppercase, lowercase and digits
present in a text file.
Ans:
CODE
Myfile1.txt
Output
Download