0% found this document useful (0 votes)
84 views29 pages

Panther

This document contains 22 programming tasks for a Computer Science class. It lists the tasks which include writing programs to calculate factorials, allow login with username and password, work with files and text, implement a stack, connect to a database, and more. A student named Aman Nailwal is assigned these tasks to complete for their class.

Uploaded by

aman nailwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views29 pages

Panther

This document contains 22 programming tasks for a Computer Science class. It lists the tasks which include writing programs to calculate factorials, allow login with username and password, work with files and text, implement a stack, connect to a database, and more. A student named Aman Nailwal is assigned these tasks to complete for their class.

Uploaded by

aman nailwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 29

KENDRIYA VIDYALAYA, SHALIMAR BAGH

DELHI-110088

ACADEMIC YEAR: 2022-23

NAME :AMAN NAILWAL

CLASS :XII ‘A’

SUBJECT :COMPUTER SCIENCE

SUB CODE :083

TEACHER : MRS. RICHA SHARMA

PGT(COMPUTER SCIENCE)

KENDRIYA VIDYALAYA SHALIMAR BAGH DELHI- 11008


S.No. Name of Practical Signature
1. Write a program in python using function to print
factorial number series of a number.
2. Write a program in python to accept username “Admin”
a default argument and password 123 entered by user
to allow login into the system.
3. Write a python program to demonstrate the concept of
variable length argument to calculate sum and product
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 “MyFile.txt”.
6. Write a program to replace all spaces from the 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:
a) Print the initial position
b) Move the cursor to 4th position
c) Display next 5 characters
d) Move the characters to the next 10 characters
e) Print the current cursor position
8. Create a binary file “client.dat” to hold records like
ClientID, Client Name and Address using the dictionary.
Write functions to write data, read them and print on
the screen.

9. Write a program to create a binary file “sales.dat” and


write a menu driven program to do the following:
a) Insert Record
b) Search Record
c) Update Record
d) Display Record
e) Exit.
10. Write a function to write data into binary file “marks.dat” and
display the records of students who scored more than 95 marks.
11. Write a program to create CSV file and store empno, name, salary and
search any empno and display name, salary and if not found
appropriate message.

INDEX
12. Write a program to generate random number from 1 to
6, simulating a dice.
13. Write program to implement Stack in Python using list.
14. Write a program to take 10 sample phishing email, and
find the most common word occurring.
15. Write a program to connect with database and store
record of employee and display records.
16. Write a program to connect with database and search
employee number in table employee and display record,
if empno not found display appropriate message.
17. Write a program to connect with database and update
the employee record of entered empno.
18. Write a program to connect with database and delete
the record of entered employee number
19. Create a student table with the student id, name, and
marks as attributes where the student id is the primary
key.
20. Insert the details of a new student in the above table
21. Delete the details of a particular student in the above
table.
22. Find the total number of customers from each country
in the table (Customer ID, Customer Name, Country)
using group by.
1. Write a python program using a function to print factorial number series
from n to m numbers.

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.

Code:

Output:
3. Write a python program to demonstrate the concept of variable length
argument to calculate product and power of the first 10 numbers.

Code:

Output:
4. Create a text file “intro.txt” in python and ask the user to write a single line
text by user input.

Code:

Output:
File:

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 MyFile.txt.

Code:
File Content:

Output:

6. Write a program to replace all spaces from the text with – (dash) from the file
intro.txT.

Code:
OUTPUT:

7. Write a program to know the cursor position and print the text according to
below given specifications:

a) Print the initial position

b) Move the cursor to 4 th position

c) Display next 5 characters

d) Move the characters to the next 10 characters

e) Print the current cursor position

Code:
Output:

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

Code:
Output:

9. Write a program to create a binary file sales.dat and write a menu driven
program to do the following:

1. Insert Record

2. Search Record

3. Update Record

4. Display Record

5. Exit

Code:
Output:

10. Write a function to write data into binary file marks.dat and display the
records of students who scored more than 95 marks.
Code:

Output:
11. Write a program to create CSV file and store empno,name ,salary and search
any empno and display name ,salary and if not found appropriate message.

Code:

Output:
12. Write a program to generate random number from 1 to 6, simulating a dice.

Code:

Output:
13. Write a program to implement Stack in python using list.

Code:
Output:
14. Write a program to take 10 sample phishing email, and find the most
common word occurring.

Code:

Output:
15. Write a program to connect with database and store record of employee
and display record.

Code:
Output:

16. Write a program to connect with database and search employee number in
table employee and display record, if empno not found display appropriate
message.

Code:
Output:

17. Write a program to connect with database and update the employee record
of entered empno.

Code:
Output:
18. Write a program to connect with database and delete the record of entered
employee number.

Code:

Output:
19. Create a student table with the student id name and mark as attributes
where the student id is the primary key.

Code:

20. Insert the detail of a new student in the above table.

Code and Output :


21. Delete the detail of a particular student in the above table.

22. Find the total number of customers from each country in the table customer
ID customer name country using group by.

TABLE:

Code and Output:

You might also like