PRACTICAL PROGRAMS
FOR GRADE – XII
[2023-2024]
Prepared by:
Mr. Appan Raj D M.C.A., B.Ed., - PGT CS/IP
1
, TABLE OF CONTENTS
S.No Name of the Exercise Page.No
Python Programs
1. Creating a menu driven program to perform arithmetic operations. 3
2. Creating a python program to display Fibonacci series 5
3. Creating a menu driven program to find factorial and sum of list of numbers using 7
function.
4. Creating a python program to implement returning value(s) from function. 9
5. Creating a python program to implement mathematical functions. 10
6. Creating a python program to generate random number between 1 to 6 11
7. Creating a python program to read a text file line by line and display each word 12
separated by '#'.
8. Creating a python program to read a text file and display the number of 13
vowels/consonants/lower case/ upper case characters.
9. Creating python program to display short words from a text file 15
10. Creating a python program to copy particular lines of a text file into another text 16
file.
11. Creating a python program to create and search records in binary file. 17
12. Creating a python program to create and update/modify records in binary file. 19
13. Creating a python program to create and search employee’s record in csv file. 21
14. Creating a python program to implement stack operations (List). 23
15. Creating a python program to implement stack operations (Dictionary). 26
Python – SQL connectivity programs
16. Creating a python program to integrate MYSQL with Python (Creating database 28
and table)
17. Creating a python program to integrate MYSQL with Python (Inserting records 30
and displaying records)
18. Creating a python program to integrate MYSQL with Python (Searching and 32
displaying records)
19. Creating a python program to integrate MYSQL with Python (Updating records) 33
SQL Queries
20. SQL COMMANDS EXERCISE – 1 35
21. SQL COMMANDS EXERCISE – 2 36
22. SQL COMMANDS EXERCISE – 3 38
23. SQL COMMANDS EXERCISE – 4 40
24. SQL COMMANDS EXERCISE – 5 42
2
,EX.NO: 1
DATE:
CREATING A MENU DRIVEN PROGRAM TO PERFORM ARITHMETIC
OPERATIONS
AIM:
To write a menu driven Python Program to perform Arithmetic operations (+,-*,/)
based on the user’s choice.
SOURCE CODE:
Result:
Thus, the above Python program has been executed and the output is verified
successfully.
3
, SAMPLE OUTPUT:
Python Program Executed Output:
***************************************************************************************
4