12 Practical Programs
12 Practical Programs
14 write a python code to create a binary file “book.dat” that has structure [BookNo,
Book_Name, Author, Price]. The following user defined function
CreateFile() is created to take input data for a record and add to book.dat and
another user defined function CountRec(Author) which accepts the Author name as
parameter and count and return number of books by the given Author.
RemoveRec() is created to delete the file matching with the author name passes as
argument.
UpdateRec() is ysed to modify the price for specific book.
Create a menu driven program for the same.
CSV File
15 Create a CSV file by entering user-id and password, read and search the
password for given userid.
16 Create a csv file for employee details with the following fields [eno,ename,
doj,desgn,basic,da,hra ] append and calculate the gross pay
17 Create csv file for employee details with the following fields [eno,ename,
doj,desgn,basic,da,hra ] search and update a record.
18 ADD() – To accept and add data of an employee to a CSV file ‘record.csv’. Each
record consists of a list with field elements as empid, name and mobile to store
employee id, employee name and employee salary respectively.
(ii) COUNTR() – To count the number of records present in the CSV file named
‘record.csv’.
Data Structure
19 Stack – Menu driven program using List
20 Write a function in Python, Push(SItem) where, SItem is a dictionary containing
the details of stationary items– {Sname:price}. The function should push the
names of those items in the stack who have price greater than 25. Also display the
count of elements pushed into the stack.