Text File
1. Write a function in Python to read a text file, Alpha.txt and displays those lines
which begin with the word ‘You’.
2. Write a function, vowelCount() in Python that counts and displays the number of
vowels in the text file named Poem.txt.
3. Write a method Find_word() in python to read the lines from a text file “India.txt”,
to find and display the occurrence of the word “INDIA”.
4. Write a method Display_word() in python to read the lines from a text file
“Poem.txt”, and display those words which are more than five characters.
5. Write a Function Change() that copies a text file “source.txt” onto “target.txt”
barring the lines starting with letter “K”.
Binary File
1. Consider a file, SPORT.DAT, containing records of the following structure:
[SportName, TeamName, No_Players]
Write a function, copyData(), that reads contents from the file SPORT.DAT and
copies the records with Sport name as “Basket Ball” to the file named
BASKET.DAT. The function should return the total number of records copied.
2. A binary file “Student.dat” has structure (adm_no,name,percent). Write a function
Count() that would read contents of the file “Student.dat” and display the details of
students whose percent is above 75. Also display No of students scoring above 75.
3. A binary file “Book.dat” has structure [b_no,b_name,author,price]
(i) Write a function CreateFile() to input data for a record and add to “Book.dat”
(ii) Write a function CountRec(author) which accepts the author name as parameter
and count and return the number of books by the given author.
csv File
1. The structure of Result.csv is :
[St_Id, St_Name, Game_Name, Result] Where
St_Id is Student ID (integer)
ST_name is Student Name (string)
Game_Name is name of game in which student is participating(string)
Result is result of the game whose value can be either 'Won', 'Lost'or 'Tie'
write the following user defined functions:
Accept() – to accept a record from the user and add it to the file Result.csv. The
column headings should also be added on top of the csv file.
wonCount() – to count the number of students who have won any event.