Sample Practical File 2023-2024
Sample Practical File 2023-2024
Python:
What is Python? Python is a high-level, interpreted programming language known
for its simplicity and readability. It was created by Guido van Rossum and first
released in 1991. Python has gained immense popularity due to its versatility and
wide range of applications.
Key Features:
Key Features:
Data Retrieval: SQL provides powerful commands for retrieving specific data from
databases using queries.
Data Manipulation: It allows for the insertion, updating, and deletion of data within
databases.
Data Definition: SQL can define the structure of a database, including tables,
indexes, and constraints.
Data Control: It provides security and access control mechanisms to protect data.
Use Cases:
THANK YOU
CERTIFICATE
Signature
(PGT For Computer Science)
INDEX
Python Programs
1. WRITE A FUNCTION TO SWAP THE VALUES OF TWO VARIABLES THROUGH A FUNCTION.
2. MENU DRIVEN PROGRAM TO PERFORM ARITHMETIC OPERATIONS USING THE CONCEPT OF FUNCTIONS
AND PARAMETERS.
3. PROGRAM TO GENERATE RANDOM NUMBER BETWEEN 1 TO 6.
a. CREATE A TABLE STUDENT WITH DUMMY 10 RECORDS AND DISPLAY SELECT, DELETE, UPDATE
OPERATIONS IN MYSQL.
b. QUERIES TO FIND THE AGGREGATE FUNCTIONS LIKE MIN(), MAX(), AVG(), SUM(), COUNT().
1. CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (INSERTING RECORDS AND
DISPLAYING RECORDS)
2. CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (SEARCHING AND DISPLAYING
RECORDS)
3. CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (UPDATING RECORDS)
COMPUTER SCIENCE
PRACTICAL EXERCISES 2023-24
CLASS – XII A
EX.NO: 1
DATE:
AIM:
To write a function to swap the values of the two variables through a function.
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
DATE:
AIM:
To make a basic arithmetic calculator using the concept of functions and parameters
SOURCE CODE:
SAMPLE OUTPUT:
Result:
Thus, the above Python program is executed successfully and the output is verified
EXP NO. 3
DATE:
AIM:
To wite a program which generates random numbers from 1 to 6 using Random module
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
EXP NO. 4
DATE:
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
DATE:
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
OUTPUT:
EXP NO 6
DATE:
PROGRAM THAT’LL COUNT THE NUMBER OF WORD “THE” OR “the” IN A TEXT FILE
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
Sample.txt
OUTPUT:
EXP NO 7
DATE:
PROGRAM THAT WILL COUNT THE NUMBER OF WORDS THAT START WITH A VOWEL
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
EXP NO 8
DATE :
WRITE A CODE THAT READ A TEXT FILE LINE BY LINE AND DISPLAY EACH WORD SEPARATED BY “#”.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
SAMPLE.TXT
OUTPUT:
EXP NO 9
DATE:
WRITE A PROGRAM THAT WILL REMOVE ALL THE LINE THAT STARTS WITH ‘A’ AND WRITE IT TO ANOTHER FILE.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
INPUT.TXT
OUTPUT.TXT
OUTPUT:
EXP NO 10
DATE
PROGRAM TO CREATE BINARY FILE TO STORE ROLLNO AND NAME, SEARCH ANY ROLLNO AND DISPLAY NAME IF
ROLLNO FOUND OTHERWISE “ROLLNO NOT FOUND”
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified
OUTPUT:
EXP NO 11
DATE
WRITE A PROGRAM TO CREATE A BINARY FILE WITH ROLL NO, NAME AND MARKS. INPUT A ROLL NUMBER AND UPDATE
THE MARKS.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified
OUTPUT:
EXP NO 12
DATE
WRITE A PROGRAM TO CREATE A BINARY FILE BY PUTTING DATA AS DICTIONARY KEYS IN A BINARY FILE
CONDITIONALLY.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified
OUTPUT:
EXP NO 13
DATE
WRITE A PROGRAM TO CREATE AND READ CSV FILE WITH EMPLOYEE NO, NAME AND SALARY USING LIST.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified
OUTPUT:
EXP NO 14
DATE:
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified
OUTPUT:
EXP NO 15
DATE:
WRITE A PROGRAM TO IMPLEMENT A STACK USING A LIST DATA-STRUCTURE DEMONSTRATING PUSH() AND POP() .
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified
OUTPUT:
SQL (Structured Query Language)
EXP NO 16
DATE:
CREATE A TABLE STUDENT WITH DUMMY 10 RECORDS AND DISPLAY SELECT, DELETE, UPDATE OPERATIONS IN MYSQL.
CODE:
DISPLAY SELECT:
DELETE:
UPDATE:
EXP NO 17
DATE
QUERIES TO FIND THE AGGREGATE FUNCTIONS LIKE MIN(), MAX(), AVG(), SUM(), COUNT().
TABLE:
DATE:
TABLE:
DISTINCT CODE:
BETWEEN CODE:
IN CODE:
LIKE CODE:
ORDER BY CODE:
EXP NO 19
DATE
TABLE:
EXP NO 20
DATE:
TABLE:
SIMPLE NATURAL JOIN:
INNER JOIN:
LEFT JOIN:
RIGHT JOIN:
Python and SQL Connectivity
EXP 21
DATE
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (INSERTING RECORDS AND DISPLAYING RECORDS)
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
OUTPUT:
EXP NO 22
DATE
CREATING A PYTHON PROGRAM TO INTEGRATE MYSQL WITH PYTHON (SEARCHING AND DISPLAYING RECORDS)
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
OUTPUT:
EXP NO 23
DATE:
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
OUTPUT: