SAMAR STUDY HALL
Responsibility to one’s community and
country above and beyond mere self
COMPUTER SCIENCE REPORT
FILE (SESSION:- 2024 -2025)
SUBMITTED To: SUBMITTED By:
Mrs. Neha Verma Aryaman Agarwal
12th Science A
Roll No.-
CERTIFICATE
This is to certify that “Aryaman
Agarwal ” student of ‘12 science A’
has successfully completed the Report
File on Python, My SQL and SQL
connectivity with dedication and
diligence under the guidance of “Mrs.
Neha Verma” during the session
2024-2025.
Principal External Internal
sign Examinerm Examiner
ACKNOWLAGEMEN
T
I would like to convey my heartfelt
gratitude to “Mrs. Neha Verma” for
her tremendous support and assistance
in the completion of my Report File. I
would also like to thank our principal
“Mr. Anuj Bhatia” for providing me
with this wonderful opportunity to work
on a project.The completion of the
project would nat have been possible
without their heip and insights.
CONTENT
Python........................................1
List, tuples and strings.................................................1
Data file Handling.........................................................4
Dictionary...................................................................10
Function and Libraries................................................15
Stack..........................................................................17
SQL.......................................20
Basic queries to create table................................................ 20
working with two tables..............................................22
Table EMPLOY.............................................................24
Table SPORTS.............................................................26
Table BOOK................................................................28
SQL Connectivity with python
.............................................
30
Creating database and table......................................30
Inserting records........................................................31
Updating records........................................................32
Display Table
...................................................................................
33
1
PYTHON
String, List and Tuples :-
1. Program that uses string operations to implement a basic
text analyzer. The program takes a paragraph as input and
provides insights about it.
Program:
Output:
1
2
2. Program to take a list and an integer as input and give 3
list of even numbers , odd number and the number divisiable
by given integer.
Program:
Output:
2
3
3. Program using tuples and loops to solve a simple
problem. This program calculates the total and average
marks of students stored in a tuple.
Program:
Output:
3
4
Data file handleing:-
1. To count the number of lines starts with “the” and show
that
lines
.
Txet file:
Program:
Output:
4
5
2. To count the number of vowel in the text file.
Text file:
Program:
Output:
3. To make a program that mange the tasks
using the concept of file handling.
5
6
Program:
6
7
Output:
7
8
4. Log In Inerface Using concept of Data ile handleing.
Program:
8
9
Output:
9
1
Dictionary
1. To Add Record in an dictionary
Program:
Output:
1
1
2. Create a contact book using a dictionary where keys
are names and values are phone numbers. Add, search,
update, and delete contacts.
Program:
1
1
Output:
1
1
1
1
1
1
Function and Libraries
1. To create a library of function to calculate area
and parameter.
Step 1: Create a new python file named
calculater.py. Step 2: Write the following function in
it.
Step 3: Now cut and paste the file in “ C:\Program
Files (x86)\Python37-32\Lib ”.
Step 4: Now we can use these function by importing
“calculater.py”.
1
1
Output:
1
1
Stack
1.Write the required functions for stack operations using
the dictionary D.
Program;
Example:
1
1
Output:
2. Write the function Push_Bright(StudRec) and
Pop_Bright(BRIGHT). Push_Bright(StudRec) will take a
nested dictionary and pushes the list of dictionary in
BRIGHT.
Program:
1
1
Example:
Output:
1
2
SQL
Queries to Create Database,Create Table,Insert
Records, Updateing Records Deleting Records and
Deleting database.
1.To create the Database:
2.To Create a table in the database:
3.To Insert the records in the table:
2
2
3. To update the record:
5. Deleting Specific Records:
6. Deleting All Records:
2
2
Consider the following tables BOOKS and ISSUED in a
database named "LIBRARY". Write SQL commands for the
statements.
TABLE: BOOKS
TABLE: ISSUED
1.Display book name and author name and price of
computer type books.
2
2
2. To increase the price of all history books by Rs 50.
3. Show the details of all books in ascending order of
their prices.
4. Display book ID, book name, and quantity issued
for all books that have been issued.
2
2
Working on Table EMPLOY
The structure:
EmpID (Primary Key)
EmpName
Department
Salary
JoinDate
1. Retrieve all employees with a salary
greater than 50,000:
2
2
2. Find the total number of employees in each
department:
3. Update the salary of employees in the "IT"
department by 10%:
4. Fetch the details of employees who joined in
2020:
5. Delete employees with a salary below 30,000:
2
2
Working on Table SPORTS
The structure:
SportID (Primary Key)
SportName
PlayerCount
Type (e.g., Indoor, Outdoor)
1. Retrieve all outdoor sports:
2
2
2. Count the total number of sports in the
database:
3. Update the player count of "Cricket" to 15:
4. Find sports that have more than 5 players:
5. Delete a sport with a specific SportID:
Working on Table BOOK
2
2
The structure:
BookID (Primary Key)
Title
Author
Price
PublishedYear
1. Retrieve books published after 2015:
2. Count the total number of books by a specific
author:
2
2
3. Update the price of a book with a specific
BookID:
4. Find books with a price range between 200 and
500:
5. Delete books published before 2000:
2
3
SQL Connectivity With
Python
To create a database and table in SQL by using Python:
Program:
3
3
Outpu
t:
To Insert the records entered by user in the table in SQL
by using Python:
3
3
Outpu
t:
To Update the records of the table in SQL by using
Python:
Program:
3
3
Outpu
t:
To Insert multiple Records entered by user in the table
of SQL and printing the table after inserting by using
Python: Program:
3
3
Outpu
t:
3
3
Bibliography
Python Documentation: https://docs.python.org/
MySQL Documentation: https://dev.mysql.com/doc/
GeeksforGeeks Articles on Python and MySQL
Integration: https://www.geeksforgeeks.org/
TutorialsPoint MySQL Tutorial:
https://www.tutorialspoint.com/mysql/index.h
tm
Stack Overflow Community
Discussions:
https://stackoverflow.com/