You are on page 1of 15

COMPUTER PRACTICAL

BINARY AND CSV FILE

(MADE BY-ANUBHAV CHAUHAN,XIIC)


INDEX
S. Description Date Remark
No
.
BINARY FILE
1. Write a function definition to write a new 14.09.21
binary file called ‘Data’ which stores
name and price of the product in the
format shown in the example.
The data is stored in the following format:
[{‘name’:’file’,’price’:112},{‘name’:
‘pen’,’price’:90}] and so on.
1) Write a function to increase the
price of all products by 10 percent.
The data is stored in the binary file
‘data2’.
2) Write a function to transfer all the
records from binary ‘data’ to ‘data3’
whose price is less than 100.
2. Write a menu driven program(Append, 14.09.21
Update Display, Exit ) to append data of a
student (name and age), update and then
display those students whose age >=18
(Data is in dictionary/list/tuple) (File to be
written and read in binary mode).
3. Write a menu driven program(Append, 14.09.21
Display, Search, Delete, Update and Exit )
to process data of an employee ( emp no,
emp name and salary). Search, Delete and
Updatemust work on empno.

CSV FILE
4. Write a python function to write the file 14.09.21
PRODUCT.CSV and display the data.The
first record of the file should be

PID, PNAME, COST, QUANTITY


5. Write a program to get item details ( code, 14.09.21
description and price) for multiple items
from the user and create a csv file by
writing all the item details in one go.

Q1 Write a function definition to write a new binary file called ‘Data’


which stores name and price of the product in the format shown in the
example.
The data is stored in the following format:
[{‘name’:’file’,’price’:112},{‘name’: ‘pen’,’price’:90}] and so on.
1) Write a function to increase the price of all products by 10 percent.
The data is stored in the binary file ‘data2’.
2)Write a function to transfer all the records from binary ‘data’ to
‘data3’ whose price is less than 100.
PROGRAM-
OUTPUT-
Q2 Write a menu driven program(Append, Update Display, Exit ) to
append data of a student (name and age), update and then display
those students whose age >=18 (Data is in dictionary/list/tuple) (File to
be written and read in binary mode).
PROGRAM-
OUTPUT-
Q3 Write a menu driven program(Append, Display, Search, Delete,
Update and Exit ) to process data of an employee ( emp no, emp name
and salary). Search, Delete and Updatemust work on empno.
PROGRAM-
OUTPUT-

Q4 Write a python function to write the file PRODUCT.CSV and


display the data.The first record of the file should be
PID, PNAME, COST, QUANTITY
PROGRAM-

OUTPUT-

Q5 Write a program to get item details ( code, description and price) for
multiple items from the user and create a csv file by writing all the item
details in one go.
PROGRAM-

OUTPUT-

You might also like