Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

CENTRAL BOARD OF SECONDARY

EDUCATION

Sapphire International School Noida


S -1, Sector 70, Noida, Uttar Pradesh 201301

TERM 1 PRACTICAL RECORD FILE

SUBMITTED TO SUBMITTED BY

Ms. Aditi Ghosh Name: Anush Vishnoi

Class: XII A

Roll No:

C S P r a c ti c a l F i l e P a g e 1 | 20
C S P r a c ti c a l F i l e P a g e 2 | 20
CERTIFICATE
This is to certify that Anush Vishnoi, student of Class XII,
Sapphire International School Noida has completed the
Term I - PRACTICAL FILE during the academic year 2021-
22 towards partial fulfilment of credit for the Computer
Science practical evaluation of CBSE and submitted
satisfactory report, as compiled in this practical file under my

supervision.

Subject Teacher Examiner

Principal

Index
No. Practical Date Signature
1 Write a python program using a function to print factorial
number series from n to m numbers.
2 Write a python program to accept username "Admin" as default
argument and password 123 entered by user to allow login into

C S P r a c ti c a l F i l e P a g e 3 | 20
No. Practical Date Signature
the system.
3 Write a python program to demonstrate the concept of variable
length argument to calculate product and power of the first 10
numbers.
4 Create a text file "intro.txt" in python and ask the user to write a
single line text by user input.
5 Write a program to count a total number of lines and count the
total number of lines starting with 'A', 'B', and 'C' from the file
dfh.txt.
6 Write a program to replace all spaces from text with – (dash)
from the file intro.txt.
7 Write a program to know the cursor position and print the text
according to below-given specifications:
1. Print the initial position
2. Move the cursor to 4th position
3. Display next 5 characters
4. Move the cursor to the next 10 characters
5. Print the current cursor position
6. Print next 10 characters from the current cursor position

8 Create a binary file client.dat to hold records like ClientID, Client


name, and Address using the list. Write functions to write data,
read them, and print on the screen.
9 Write a program to store customer data into a binary file
cust.dat using a dictionary and print them on screen after
reading them. The customer data contains ID as key, and name,
city as values.
10 Write a program to create a binary file sales.dat and write a
menu driven program to do the following:
Insert record
• Search Record
• Update Record
• Display record
• Exit
11 Write a function to write data into binary file marks.dat and
display the records of students who scored more than 95 marks.
12 Read a CSV file top5.csv and print the contents in a proper
format. The data for top5.csv file are as following:

C S P r a c ti c a l F i l e P a g e 4 | 20
No. Practical Date Signature

13 Read a CSV file students.csv and print them with tab delimiter.
Ignore first row header to print in tabular form.

14 Write records of customer into result.csv. The fields are as


following:

15 Count the number of records and column names present in the


CSV file. Concepts used:
1. Skip first row using next() method
2. line_num properties used to count the no. of rows

C S P r a c ti c a l F i l e P a g e 5 | 20
1 Write a python program using a function to print factorial number series from n to m numbers.
Python Code:

Output:

2 Write a python program to accept username "Admin" as default argument and password 123
entered by user to allow login into the system.
Python Code:

Output:

C S P r a c ti c a l F i l e P a g e 6 | 20
3 Write a python program to demonstrate the concept of variable length argument to calculate
product and power of the first 10 numbers.
Python Code:

Output:

4 Create a text file "intro.txt" in python and ask the user to write a single line text by user input.
Python Code:

Output:

C S P r a c ti c a l F i l e P a g e 7 | 20
5 Write a program to count a total number of lines and count the total number of lines starting
with 'A', 'B', and 'C' from the file dfh.txt.
Python Code:

File Content
Python is super and trending language.
Allows to store the output in the files.
A text file stores textual data.
Binary files can handle binary data.
Binary files use pickle module to store data.
CSV files can handle tabular data.
CSV files can be read easily using CSV reader object.

C S P r a c ti c a l F i l e P a g e 8 | 20
Output:

6 Write a program to replace all spaces from text with – (dash) from the file intro.txt.
Python Code:

Output:

7 Write a program to know the cursor position and print the text according to below-given
specifications:
1. Print the initial position
2. Move the cursor to 4th position
3. Display next 5 characters
4. Move the cursor to the next 10 characters
5. Print the current cursor position
6. Print next 10 characters from the current cursor position

C S P r a c ti c a l F i l e P a g e 9 | 20
Python Code:

Output:

8 Create a binary file client.dat to hold records like ClientID, Client name, and Address using the
list. Write functions to write data, read them, and print on the screen.
Python Code:

C S P r a c ti c a l F i l e P a g e 10 | 20
Output:

9 Write a program to store customer data into a binary file cust.dat using a dictionary and print
them on screen after reading them. The customer data contains ID as key, and name, city as
values.
Python Code:

C S P r a c ti c a l F i l e P a g e 11 | 20
C S P r a c ti c a l F i l e P a g e 12 | 20
C S P r a c ti c a l F i l e P a g e 13 | 20
Output:

10 Write a program to create a binary file sales.dat and write a menu driven program to do the
following:
Insert record
• Search Record
• Update Record
• Display record
• Exit

C S P r a c ti c a l F i l e P a g e 14 | 20
Python Code:

Output:

C S P r a c ti c a l F i l e P a g e 15 | 20
11 Write a function to write data into binary file marks.dat and display the records of students

C S P r a c ti c a l F i l e P a g e 16 | 20
who scored more than 95 marks.
Python Code:

Output:

12 Read a CSV file top5.csv and print the contents in a proper format. The data for top5.csv file
are as following:

Python Code:

C S P r a c ti c a l F i l e P a g e 17 | 20
Output:

13 Read a CSV file top5.csv and print them with tab delimiter. Ignore first row header to print in
tabular form.
Python Code:

Output:

C S P r a c ti c a l F i l e P a g e 18 | 20
14 Write records of customer into result.csv. The fields are as following:

Python Code:

Output:

C S P r a c ti c a l F i l e P a g e 19 | 20
15 Count the number of records and column names present in the CSV file. Concepts used:
1. Skip first row using next() method
2. line_num properties used to count the no. of rows

Python Code:

Output:

C S P r a c ti c a l F i l e P a g e 20 | 20

You might also like