Xii CS Practical Programs 2024 - 2025
Xii CS Practical Programs 2024 - 2025
XII COMPUTER
XII - SCIENCE
COMPUTERWITH PYTHON
SCIENCE
TERM 1
PRACTICAL PROGRAMS
1. Write a python program to search an element in a list and display the frequency of
element present in list and their location using Linear search by using user defined
function. [List and search element should be entered by user]
2. Write a python program to search an element in a list and display the frequency of
element present in list and their location using binary search by using user defined
function. [List and search element should be entered by user]
3. Write a python program to pass list to a function and double the odd values and
half even values of a list and display list element after changing.
4. Write a Python program input n numbers in tuple and pass it to function to count how
many even and odd numbers are entered.
5. Write a Python program to function with key and value, and update value at that
key in dictionary entered by user.
6. Write a Python program to pass a string to a function and count how many vowels
present in the string.
9.
8. Write a python program to implement python string functions.
9.
10. Write a python program to read and display file content line by line with each
word separated by #.
10.
11. Write a python program to remove all the lines that contain the character ‘a’ in a
file and write
it to another file.
11.
12. Write a python program to read characters from keyboard one by one, all lower
case letters
gets stored inside a file “LOWER”, all uppercase letters gets stored inside a file
“UPPER”, and all other characters get stored inside “OTHERS”
2
12.
13. Write a python program to create a binary file with name and roll number.
Search for a given roll number and display name, if not found display appropriate
message.
14.13. Write a python program to create a binary file with roll number, name and
marks, input a roll number and update the marks.
15. 14. Write a python program to create a CSV file with empid, name and mobile
no. and search empid, update the record and display the records.
TERM2
16. 15. (i)Write a Python program to create Lpush( ) and Lpop( ) function to do push
and pop operation on a stack using a list e.g. take a student information and push and
pop the details.(ii)stack using flight details(iii)stack using bank details
17. 16. Create a student table and insert data. Implement the following SQL commands
on the student table:
ALTER table to add new attributes / modify data type / drop attribute
UPDATE table to modify data ORDER By to display data in ascending /
descending order DELETE to remove tuple(s) GROUP BY and find the min,
max, sum, count and average(ii) bank table (iii) flight table(iv) hospital table
18.17. Integrate SQL with Python by importing the MySQL module record of employee
and display the record.
19. 18. Integrate SQL with Python by importing the MySQL module to search an
employee using empno and if present in table display the record, if not display
appropriate method.
20. 19. Integrate SQL with Python by importing the MySQL module to search a
student using rollno, update the record.
21. 20. Integrate SQL with Python by importing the MySQL module to search a
student using rollno, delete the record.
22. 21. Take a sample of ten phishing e-mails (or any text file) and find most
commonly occurring word(s)
3
PRACTICAL- 1
LINEAR SEARCH - LIST
INPUT
OUTPUT
RESULT:
Thus, the linear list concept done through list concept successfully
4
BINARY SEARCH
PRACTICAL- 2 - LIST
INPUT
OUTPUT
RESULT:
5
LIST DEFAULT3FUNCTION
PRACTICAL-
INPUT
OUTPUT
RESULT:
6
FUNCTION WITH TUPLE
PRACTICAL- 4
INPUT
OUTPUT
OUTPUT:
8
FUNCTIONS WITH DICTIONARY
PRACTICAL- 5
AIM- Write a program to function with key and value, and update value
at that key in dictionary entered by user
INPUT
OUTPUT
RESULT:
10
STRING WITH SELECTION STATEMENT
PRACTICAL- 6
INPUT
OUTPUT
RESULT:
11
RANDOM FUNCTION
PRACTICAL- 7
INPUT
OUTPUT(S)
RESULT:
13
STRING FUNCTIONS
PRACTICAL- 9- 8
AIM- Write a program to implement python string functions
SOFTWARE USED- IDLE (PYTHON 3.8 64-BIT)
INPUT
OUTPUT
RESULT:
19
FILE HANDLING -TEXT WITH READLINE
PRACTICAL-- 10
9
AIM- Write a program to read and display file content line by line
with each word separated by #.
SOFTWARE USED- IDLE (PYTHON 3.8 64-BIT)
INPUT
OUTPUT
RESULT:
20
FILE HANDLING - TEXT
PRACTICAL- FILE
-1110
AIM- Write a program to remove all the lines that contain the
character ‘a’ in a file and write it to another file.
SOFTWARE USED- IDLE (PYTHON 3.8 64-BIT)
INPUT
OUTPUT
RESULT:
Thus, the experiment executed successfully
21
FILE WITH STRING
PRACTICAL- -1211
INPUT
CRL\
OUTPUT
RESULT: 22
Thus, the experiment executed successfully
FILE HANDLING - BINARY
PRACTICAL- -1312 WITH DUMP
AIM- Write a program to create a binary file with name and roll number.
search for a given roll number and display name, if not found display
appropriate
INPUT
OUTPUT
RESULT:
23
Thus, the experiment executed successfully
FILE HANDLING - BINARY
PRACTICAL- -1413 LOAD WITH DUMP
AIM- Write a program to create a binary file with roll number, name
and marks, input a roll number and update the marks.
SOFTWARE USED- IDLE (PYTHON 3.8 64-bit)
INPUT
OUTPUT
RESULT:
24
Thus, the experiment executed successfully
FILE HANDLING - CSV FILE
PRACTICAL- -1514
AIM- Write a program to create a CSV file with empid, name and
mobile no. and search empid, update the record and display the
records
SOFTWARE USED- IDLE (PYTHON 3.8 64-BIT)
INPUT
25
OUTPUT
RESULT:
26
STACK - 15
PRACTICAL- 16
INPUT
27
OUTPUT
RESULT:
28
SQL - COMMANDS
PRACTICAL - 16
PRACTICAL- 17
DELETE to remove tuple(s) GROUP BY and find the min, max, sum, count and
average
INPUT
use studentdb;
Database changed
CREATING TABLE
desc student;
INSERTING VALUE
desc student;
UPDATING VALUE
30
update student set Percentage = 55 where roll = 6;
desc student;
desc student;
ORDER BY COMMAND
31
AVERAGE COMMAND
COUNT COMMAND
RESULT: 32
INPUT
OUTPUT
RESULT:
33
MYSQL INTERFACE - SELECT
PRACTICAL - 18 FUNCTION
PRACTICAL- 19
INPUT
OUTPUT
RESULT:
35
MYSQL INTERFACE - UPDATE- FUNCTION
PRACTICAL 19
PRACTICAL- 20
INPUT
OUTPUT
RESULT:
37
MYSQL INTERFACE - DELETE FUNCTION
PRACTICAL - 20
PRACTICAL- 21
INPUT
OUTPUT
RESULT:
38
FILE HANDLING - PHISHING
PRACTICAL - 21
PRACTICAL- 22
INPUT
OUTPUT
RESULT:
40