0% found this document useful (0 votes)
87 views11 pages

Ex1 - Ex 5

Uploaded by

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

Ex1 - Ex 5

Uploaded by

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

COMPUTER SCIENCE

PRACTICAL PROGRAMS
FOR GRADE – XII
[2023-2024]

Prepared by:
Mr. Appan Raj D M.C.A., B.Ed.,
1 - PGT CS
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 12
7. Creating a python program to read a text file line by line and display each word 14
separated by '#'.
8. Creating a python program to read a text file and display the number of 15
vowels/consonants/lower case/ upper case characters.
9. Creating python program to display short words from a text file 17
10. Creating a python program to copy particular lines of a text file into another text 18
file.
11. Creating a python program to create and search records in binary file. 20
12. Creating a python program to create and update/modify records in binary file. 22
13. Creating a python program to create and search employee’s record in csv file. 24
14. Creating a python program to implement stack operations (list). 26
15. Creating a python program to implement stack operations (dictionary). 30
Python – SQL connectivity programs
16. Creating a python program to integrate mysql with python (creating database 32
and table)
17. Creating a python program to integrate mysql with python (inserting records and 34
displaying records)
18. Creating a python program to integrate mysql with python (searching and 36
displaying records)
19. Creating a python program to integrate mysql with python (updating records) 37
SQL Queries
20. SQL PRACTICAL – 1 39
21. SQL PRACTICAL – 2 40
22. SQL PRACTICAL – 3 42
23. SQL PRACTICAL – 4 44
24. SQL PRACTICAL - 5 46

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
EX.NO: 2
DATE:
CREATING A PYTHON PROGRAM TO DISPLAY FIBONACCI SERIES

AIM:
To write a Python Program to display Fibonacci Series up to ‘n’ numbers.

SOURCE CODE:

Result:
Thus, the above Python program has been executed and the output is verified
successfully.

5
SAMPLE OUTPUT:
Python Executed Program Output:

*****************************************************************************************

6
EX.NO: 3

DATE:

CREATING A MENU DRIVEN PROGRAM TO FIND FACTORIAL AND SUM OF LIST OF


NUMBERS USING FUNCTION.

AIM:

To write a menu driven Python Program to find Factorial and sum of list of numbers
using function.

SOURCE CODE:

Result:
Thus, the above Python program has been executed and the output is verified
successfully.

7
SAMPLE OUTPUT:

Python Executed Program Output:

************************************************************************************************

8
EX.NO: 4

DATE:

CREATING A PYTHON PROGRAM TO IMPLEMENT RETURNING VALUE(S)


FROM FUNCTION

AIM:

To Write a Python program to define the function Check(no1,no2) that take two numbers and
Returns the number that has minimum ones digit.

Source Code:

Result:
Thus, the above Python program has been executed and the output is verified
successfully.

Sample Output:

**********************************************************************************

9
EX.NO: 5

DATE:

CREATING A PYTHON PROGRAM TO IMPLEMENT MATHEMATICAL FUNCTIONS

AIM:
To write a Python program to implement python mathematical functions to find:
(i) To find Square of a Number.
(ii) To find Log of a Number(i.e. Log10)
(iii) To find Quad of a Number

SOURCE CODE:

Result:
Thus, the above Python program has been executed and the output is verified
successfully.

10
SAMPLE OUTPUT:
Python Executed Program Output:

**************************************************************************************

11

You might also like