Practical File
Practical File
PRACTICAL FILE
Computer Science
Subject Code: 083
Class 12-B
Session: 2025-26
CERTIFICATE
INDEX
Part A – Python Programs:
Python Revision tour:
1) List Menu Driven Program
2) Dictionary Menu Dirven Program
Working with Functions:
3) Using a function to display prime
numbers between m & n
4) Using a function to calculate interest
using various arguments.
5) Using a function to find the largest
element in a list. Pass the list object as
argument
6) Using a function to count the numbers
of vowels in passed string
Exception Handling:
7) Take two integers and perform addition
of two numbers to handle exception when
non-integers entered by user
8) Find the square root of a positive
number, raise a custom exception when user
enters a negative number.
File Handling:
9) Find and replace a word in a text file
Aditya Kashyap Class – 12th B CS Practical file
SHOW DATABASES;
Aditya Kashyap Class – 12th B CS Practical file
3) Open a database.
USE practical_26;
DESC Games;
Table Songs:
Price INT,
Rating INT(2),
Sold VARCHAR(3) DEFAULT 'NO'
);
"""
cursor.execute(strSQL)
print("Table created successfully or
already exists.")
mydb.close()
if not records:
print(f"{G_Name} not found.")
else:
print(f"{G_Name} FOUND:")
print("Details:")
for row in records:
print(row)
mydb.close()
Aditya Kashyap Class – 12th B CS Practical file
if cursor.rowcount == 0:
print("No such game found.")
else:
print("Game deleted successfully.")
mydb.close()
if choice == 1:
new_name = input("Enter new Game
Name: ")
Aditya Kashyap Class – 12th B CS Practical file
mydb.commit()
print("Game details updated
successfully.")
mydb.close()
v = (new_sold, G_No)
if cursor.rowcount == 0:
print("No such game found.")
else:
print("Sold status updated
successfully.")
mydb.close()
# MAIN PROGRAM
while True:
menu()
c = rChoice()
if c == 1:
Create_T()
elif c == 2:
Insert_R()
elif c == 3:
Show_T()
elif c == 4:
Search()
elif c == 5:
Aditya Kashyap Class – 12th B CS Practical file
Update()
elif c == 6:
Delete()
elif c == 7:
Update_Sold()
elif c == 8:
print("Exiting program...")
break
else:
print("WRONG CHOICE")