List of Practicals 2022-23 Class Xii CS
List of Practicals 2022-23 Class Xii CS
2 Write a python program using function named largest(a,b,c) which will accept 3 numbers as
parameters and return the largest one. Use the concept of KEYWORD parameters.
3 Write a program to calculate compound interest using function named
compint(P,r,n,t) ,where the default value of rate( r) is 10.
4 Write a program using function to print Fibonacci series upto n terms. Give default value of
n as 15.
7 Write a program to enter a list and find the largest and smallest element in the list.
8 Write a program to enter a list and replace the even elements by their square and odd by
their cube.
9 Write a program to enter a tuple and find the sum and average of all the elements.
10 Write a program to create a dictionary having names of your friends as keys and their phone
number as values.
11 Write a python program to read and display text file content with each word separated by
#.
12 Write a python program to copy all the lines that contain the character ‘a’ in a text file
“file1.txt” to another file “file2.txt”.
13 Write a menu driven program using functions to find the following in text file “story.txt”
● Upper case letters
● Lower case letters
● Digits
● Spaces
● vowels
14 Write a menu driven program using functions to count following in text file “story.txt”
● Total words
● Words having length 5
● “hello”
15 Write a menu driven program to find the following in text file “story.txt”
● To count lines starting with ‘P’ or ‘T’
● To count lines starting with vowels
16 Write a python program to create a binary file with roll number, name and address. Search
for a given roll number and display name and address , if not found display appropriate
message.
17 Write a python program to create a binary file with roll number, name and marks, input a
roll number and update the marks.
18 A binary file “Book.dat” has structure [BookNo, Book_Name, Author, Price].
i. Write a user defined function CreateFile() to input data for a record and add to Book.dat .
ii.Write a function CountRec(Author) in Python which accepts the Author name as parameter and
count and return number of books by the given Author are stored in the binary file “Book.dat”
20. 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.
21. Program in Python to create a stack named ‘book’ which contains these book details :
(bookno, book name). That is, now each item node ofthe stack containstwo types of information
– a bookno and its name. Implement Push, Pop, and Traversal operations on the stack.
22. Each node of a STACK contains the following information: (i) Pin code of a city, (ii) Name of
city. Write a program to implement following operations on abovestack.
(a.) PUSH( ) – To push a node into the stack.
(b.) POP( ) – To remove a node from the stack
23. Write a python program to create stack Sport_Stack to store age of sportsman using stack
implementation as list. Write Operation for Push, Pop and Traversal operation using menu.
24. Create a CLUB table as mentioned with given data type and constraints.
Table - CLUB
Field Name Data Type Data Limit Constraint
sports Char 10
datofapp Date
26. Write a menu-driven program which integrates MySQL and Python connectivity with
the table BOOKS whose content is given below. Create the database named LIBRARY.
Database Name- LIBRARY
Table Name- BOOKS
Make Book_id as the primary key.