Professional Documents
Culture Documents
Report File Xii Lab Programs 13 To 18
Report File Xii Lab Programs 13 To 18
Report File Xii Lab Programs 13 To 18
RESULT:
Thus the user defined functions to create a binary file ‘Books.dat’ and to search and display the book
names number of books by the given Author has been developed in Python and executed
successfully.
EX.NO:14 WORKING WITH BINARY FILE IN PYTHON
Create a binary file, Update and display the records from the binary file
AIM:
(i) To write a user defined function AddData() to input and add the records to the binary file
‘Employee.dat’ which has the structure { ‘EmpCode’: _______, ‘EmpName’:_________,
‘Designation’:_______,’Salary’:________ }.
(ii) To write a function UpdateRec(Desgn) which accepts the designation as parameter and update the
salary for the employees with the given designation in the file ‘Employee.dat’. Also display the
records from the file.
SOURCE CODE:
RESULT:
Thus the user defined functions to add records to a binary file ‘Employee.dat’ and to update the salary
and display the records in the file has been developed in Python and executed successfully.
RESULT:
Thus the user defined functions to add records to a csv file ‘Students.csv’ and to search and display
the records in the file has been developed in Python and executed successfully.
EX.NO:17 WORKING WITH CSV FILE IN PYTHON
Create a CSV file, Update and display the records from the CSV file
AIM:
To write a Menu driven Python program to implement the following user defined functions.
(i) Create() to input and add the records to the csv file ‘Customers.csv’ which has the structure
[Cust_ID,Cust_Name,City, Contact_No]
(ii) UpdateRec(code) to update the contact number of the customer for the code given by the user
(iii) Display the records stored in the file Customers.csv
SOURCE CODE:
RESULT:
Thus the menu driven python program with separate user defined functions to add records to a csv file
‘Customers.csv’ and to update and display the records in the file has been developed in Python and
executed successfully.
EX.NO:18 IMPLEMENTATION OF STACK USING LIST IN PYTHON
AIM:
Consider a dictionary containing non fiction book names and their ratings as key value pairs
as below.
Books={"Behind the beautiful forevers":8.5,"Omnivore's Dilemma":7,"Unnatural
Selection":6.5,"Guns, Germs and Steel":9,"Business Adventures":7.5,"The power of Full
engagement":9.5}
To write a python program with separate user defined functions to perform the following
operations.
(i) Push the keys (Book name) of the dictionary into the stack, where the corresponding value
(rating) is more than 8.
(ii) Pop and display the content of the stack.
Source Code:
RESULT:
Thus the python program with separate user defined functions to implement the stack using list has
been developed in Python and executed successfully.