0% found this document useful (0 votes)
9 views36 pages

C.S Practical File

Uploaded by

Panav Bora
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)
9 views36 pages

C.S Practical File

Uploaded by

Panav Bora
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/ 36

Computer

Science,
Practical file
Python and
MySQL
2024-25

Student Details
Name: PANAV BORA
Class: XII Science(PCM)
Roll Number: 1212
School : KV O.N.G.C JORHAT, ASSAM
Submitted to : Mrs Hema Sharma
ACKNOWLEDGEMENT
This is to certify that, student
named Panav Bora of class XII
has successfully completed the
Computer Science p Under the
guidance of Mrs. Hema Sharma

________
Signature
Mrs. Hema Sharma
1 To display first 10 characters of second line TEXT FILE
from the file data.txt func name is first10()
2 to count the number of 5-letter words in a TEXT FILE
text file named data.txt
3 to reverse the content of a text file TEXT FILE

4 to count the number of vowels and consonants


in a text file along with their percentage
TEXT FILE

5 to change a specific word an all its


occurrences in a text file
TEXT FILE

6 To Add sports info and check for gold medal


in a csv file
CSV FILE

7 to append data and display data of student


with more than 85% in a csv file
CSV FILE

8 to filter out the people with the age above


30
CSV FILE

9 to sort the records in a csv file by age in


ascending order
CSV FILE

10 to calculate the total sales for each product,


and write the updated data to a new CSV file
CSV FILE

11 To write name, age, roll number into a binary


file
BINARY FILE

12 to read data from a binary file: BINARY FILE

13 to append data into a binary file BINARY FILE

14 to store a list of dictionaries in a binary


file
BINARY FILE

15 to read a list of dictionaries In a binary


file
BINARY FILE

16 Display the total number of students,


highest marks obtained in each class and
MY SQL
combine the results into a single query
17 to retrieve the list of unique products
ordered by each customer, ensuring that
MY SQL
duplicate products ordered by the same
customer are not included
18 to calculate total spending by each customer MY SQL

19 to display customers who have spent more


than 400
MY SQL

21
20 to calculate the average value per customer MY SQL

21 Write 4 functions named- push, pop, is_empty


and display for a stack in python
STACK

22 a function to convert decimal number to


binary using stack in python
STACK

23 to connect to MYSQL and create a table in


python
PYTHON-SQL

24 to insert data into a database from python


using python-MYSQL connectivity
PYTHON-SQL

25 to update the grade to Graduated for the


student John Doe using python-SQL
PYTHON-SQL
connectivity
26 to delete a record from SQL database using
python-SQL
PYTHON-SQL

27 to add a column (“phone_number”) into the


database using python-SQL connectivity
PYTHON-SQL

28 to count the number of records using SQL-


python connectivity
PYTHON-SQL

29 to fetch and display the titles, genres,


authors, and their countries using SQL-
PYTHON-SQL
python connectivity
30 to fetch records of students with age more
than or equal to 17 using SQL-python
PYTHON-SQL
connectivity
CODE-1
#WAP To display first 10 characters
of second line from the file
data.txt func name is first10()

FILE:

OUTPUT:
CODE-2
#WAP to count the number of 5-
letter words in a text file named
data.txt:

OUTPUT:
CODE-3
#WAP to count the number of
vowels and consonants in a text
file along with their percentage:

OUTPUT:
CODE-4
#WAP to reverse the content of a
text file:

OUTPUT:
CODE-5
#WAP to change a specific word an
all its occurrences in a text
file:

OUTPUT:
CODE-6
#WAP To Add sports info and check
for gold medal in a csv file:

OUTPUT:
CODE-7
#WAP to append data and display data
of student with more than 85% in a
csv file

OUTPUT:
CODE-8
#WAP to filter out the people
with the age above 30:

OUTPUT:
CODE-9
#WAP to sort the records in a csv
file by age in ascending order:

OUTPUT:
CODE-10
#WAP to calculate the total sales
for each product, and write the
updated data to a new CSV file.

OUTPUT:
CODE-11
#WAP To write name, age, roll
number into a binary file :

OUTPUT:
CODE-12
#WAP to read data from a binary
file:

OUTPUT:
CODE-13
#WAP to append data into a binary
file:

OUTPUT:
CODE-14
#WAP to store a list of
dictionaries in a binary file:

OUTPUT:
CODE-15
#WAP to read a list of
dictionaries In a binary file:

OUTPUT:
CODE-16
#Write a query to:
Display the total number of students, highest
marks obtained in each class and combine the
results into a single query

QUERY WITH OUTPUT:


CODE-17
#WAQ to retrieve the list of unique
products ordered by each customer,
ensuring that duplicate products
ordered by the same customer are not
included.

QUERY WITH OUTPUT:


CODE-18
#WAQ to calculate total spending
by each customer:

QUERY-OUTPUT:
CODE-19
#WAQ to display customers who
have spent more than 400:

QUERY-OUTPUT:
CODE-20
#WAQ to calculate the average
value per customer:

QUERY-OUTPUT:
CODE-21
#Write 4 functions named- push,
pop, is_empty and display for a
stack in python

OUTPUT:
CODE-22
#Write a function to convert
decimal number to binary using
stack in python:

OUTPUT:
CODE-23
#WAP to connect to MYSQL and
create a table in python:

OUTPUT:

At SQL:
CODE-24
#WAP to insert data into a
database from python using
python-MYSQL connectivity:

OUTPUT:

At SQL:
CODE-25
#WAP to update the grade to
Graduated for the student John
Doe using python-SQL
connectivity:

OUTPUT:

At SQL:
CODE-26
#WAP to delete a record from SQL
database using python-SQL
connectivity:

OUTPUT:

At SQL:
CODE-27
#WAP to add a
column(phone_number) into the
database using python-SQL
connectivity:

OUTPUT:

At SQL:
CODE-28
#WAP to count the number of
records using SQL-python
connectivity:

OUTUPUT:
CODE-29
#WAP to fetch and display the
titles, genres, authors, and
their countries using SQL-python
connectivity:

OUTPUT:
CODE-30
#WAP to fetch records of
students with age more than or
equal to 17 using SQL-python
connectivity:
0

OUTPUT:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy