0% found this document useful (0 votes)
21 views65 pages

FFFFFFFFFFFFFVG

Uploaded by

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

FFFFFFFFFFFFFVG

Uploaded by

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

JAIN INTERNATIONAL RESIDENTIAL SCHOOL

KANAKAPURA, KARNATAKA

PRACTICAL FILE

For
AISSCE 2023 Examination
[As a part of the Computer Science Course]

SUBMITTED BY
VIHAAN GOWDA
JAIN INTERNATIONAL RESIDENTIAL SCHOOL
KANAKAPURA, KARNATAKA

This is to certify that Master Vihaan Gowda of class XII C has

satisfactorily completed the course of programs in practical

Session 2024-25 in partial fulfilment of CBSE’s AISSCE

Examination 2025.

Name: Vihaan Gowda


Reg No.: ……………………………

………………………… ……………………………..
Signature of External Examiner Signature of Internal Examiner

Signature of Principal ………………….


Place: JAKKASANDRA
Date: ……………..
CONTENTS
SL.No Date Name Of Program Page Remarks
No.
1 10 – 6 – 22 RANDOM NUMBER 1
GENERATOR

2 20-6-22 PHONE BOOK USING 2-6


DICTIONARY

3 30-6-22 INDEX OF NON ZERO 7


NUMBERS

4 6-7-22 AREA OF SHAPES USING 8-12


MODULES

5 13-7-22 TEXT FILE -I 13

6 20-7-22 TEXT FILE -II 14-15

7 3-8-22 TEXT FILE- III 16-17

8 10-8-22 TEXT FILE- IV 18

9 17-8-22 BINARY FILE - I 19-20

10 24-8-22 BINARY FILE - II 21-23

11 31-8-22 CSV FILE - I 24-26

12 7-9-22 CSV FILE - II 27-29

13 14-9-22 STRING PALINDROME - 30


USING STACK

14 21-9-22 APPLICATION OF STACK – TO 31-32


STORE NOVOWEL WORDS
15 28-9-22 DATA STRUCTURE - STACK 33-36

16 6-10-22 LINEAR SEARCH 37

17 19-10-22 DATABASE CONNECTIVITY-I 38-40

18 26 - 10-22 DATABASE CONNECTIVITY-II 41-43

19 16-11-22 DATABASE CONNECTIVITY-III 44-45

20 23-11-22 DATABASE CONNECTIVITY-IV 46

21 1-12-22 MYSQL SET -I 47-51

22 5-12-22 MYSQL SET -II 52-57

23 8-12-22 MYSQL SET -III 58-62

24 14-12-22 MYSQL SET -IV 63-66

25 15-12-22 MYSQL SET-V 67-70


PYTHON PROGRAMS

PROGRAM 1

AIM

Write a program to enter two numbers and print the sum,

difference, product and quotient of the two numbers.

PROGRAM

a=int(input('Enter 1st number:'))

b=int(input('Enter 2nd number:'))

s=a+b

d=a-b

p=a*b

q=a%b

print('The Sum is',s)

print('The Difference is',d)

print('The Product is',p)

print('The Quotient is',q)

OUTPUT

Enter 1st number:24

Enter 2nd number:12

The Sum is 36

The Difference is 12

The Product is 288

The Quotient is 0

PROGRAM 2
AIM

Write a program to accept a number and print if the number is an

Armstrong number or not.

PROGRAM

a=int(input("Enter a number:"))

l=len(str(a))

s=0

t=a

while(a>0):

r=a%10

s=s+r**l

a=a//10

if t==s:

print('The number is a armstrong number')

else:

print('The number is NOT a armstrong number')

OUTPUT

Enter a number:256

The number is NOT a armstrong number

PROGRAM 3
AIM

Write a program to accept a number and print if the number is a

prime number or not.

SOURCE CODE

a=int(input('Enter a number:'))

s=0

for i in range(2,(a//2+1)):

if (a%i==0):

s=1

break

if(s==0):

print("It is a Prime number")

else:

print("It is not a Prime number")

OUTPUT

Enter a number:19

It is a Prime number

PROGRAM 4:
AIM:

Write a program to create a function factorial to accept a number and print the factorial of the
number.

PROGRAM:

a=int(input('enter the number:'))

p=1

while a>0:

p*=a

a-=1

print('the factorial is',p)

OUTPUT:

enter the number:4

the factorial is 24

PROGRAM 5:
AIM:

Write a program to create a function words to accept a string and print the number of words in the
string, function palindrome to print if the string is palindrome and function count to count the
occurrence of the letter ‘T’ in the string.

PROGRAM:

def words():

a=input('enter string:')

y=a.split()

z=len(y)

print('the number of words in the string is:',z)

def palindrome():

b=input('enter string:')

if b[::-1]==b:

print('it is a palindrome')

else:

print('it is not a palindrome')

def count():

s=0

c=input('enter string:')

for i in c:

if i=='t':

s+=1

print('the number of Ts in the string is',s)

words()

palindrome()

count()

OUTPUT:

Enter string:this is a computer


The number of words in the string is: 4

Enter string:malayalam

it is a palindrome

Enter string:tea time

PROGRAM 6:

AIM: A Program to enter a list of elements and pass the list to a

function and display the elements and index of the non-zero

elements.

SOURCE CODE:

def index_list(l):

t=[]

for i in range(0,len(l)):

if l[i]!=0:

t.append(i)

return(t)

d=eval(input(“enter”))

print(index_list(d))

OUTPUT:

enter[10,2,3,22,50]

[0, 1, 2, 3, 4]

PROGRAM 7
AIM
A program to find area of different shapes using user defined
functions.

PROGRAM

choice='yes'

def circle(r):

print('the are of the circle is: ',3.14*r**2)

def rectangle(l,b):

print('the area of rectangle is: ',l*b)

def square(s):

print('the area of the square is: ',s*s)

def triangle(b,h):

print('the area of triangle is: ',0.5*b*h)

while choice=='yes':

print('1.circle')

print('2.rectangle')

print('3.square')

print('4.triangle')

choice2=int(input('enter shape choice: '))

if choice2==1:

r=int(input('enter the radius: '))

circle(r)

elif choice2==2:

l=int(input('enter the length: '))

b=int(input('enter the breadth: '))

rectangle(l,b)

elif choice2==3:

s=int(input('enter the side: '))

square(s)

else:

b=int(input('enter the base: '))

h=int(input('enter the height: '))

triangle(b,h)
choice=input('do you want to continue? yes/no:')

OUTPUT

1.circle

2.rectangle

3.square

4.triangle

enter shape choice: 2

enter the length: 10

enter the breadth: 20

the area of rectangle is: 200

do you want to continue? yes/no:yes


PROGRAM 8

AIM

A program to read a text file line by line and display each word

separated by a #.

PROGRAM

y=open(r'C:\Users\students\Desktop\daylight.txt',"r")

x=y.read()

z=x.split()

for i in z :

a=i+"#"

print(a,end="")

OUTPUT

There's#darkness#in#the#distance#From#the#way#that#I've#been#livin'#But#I#know#I#can't#resis
t#it#Oh,#I#love#it#and#I#hate#it#at#the#same#time#You#and#I#drink#the#poison#from#the#sam
e#vine#Oh,#I#love#it#and#I#hate#it#at#the#same#time#Hidin'#all#of#our#sins#from#the#daylight
#From#the#daylight,#runnin'#from#the#daylight#From#the#daylight,#runnin'#from#the#daylight#
Oh,#I#love#it#and#I#hate#it#at#the#same#time#
PROGRAM 9

Read a text file and display the number of

vowels/consonants/capital and small letters.

SOURCE CODE

y=open(r'C:\Users\students\Desktop\daylight.txt',"r")

x=y.read()

v=0

c=0

cap=0

s=0

for i in x:

if i in ['a','e','i','o','u','A','E','I','O','U']:

v=v+1

else:

c=c+1

y.seek(0)

for i in x:

if i>='A' and i,='Z':

cap=cap+1

else:

s=s+1

print('The no of vowels is',v)

print('The no of consonants is',c)

print('The no of capital letter is',cap)

print('The no of small letter is',s)

OUTPUT

The no of vowels is 121

The no of consonants is 287

The no of capital letter is 20

The no of small letter is 388


PROGRAM 10

QUESTION

A program to remove all the lines that contain the character

‘a’ in a file and write it to another file.

INPUT

y=open(r'C:\Users\students\Desktop\daylight.txt',"r")

l=[]

x=y.readlines()

for i in x():

if 'a' not in i:

l.append(i)

print(l)
PROGRAM 11

QUESTION

A Program to read a text file and count the number of

occurrence of a word in the text file.

INPUT

y=open(r'C:\Users\students\Desktop\daylight.txt',"r")

a=input('Enter a word:')

l=0

x=y.read()

t=x.split()

for i in t:

if a==i:

l=l+1

print(‘The occurance is’,l)

OUTPUT

Enter a word:I

The occurance is 9
PROGRAM 12

AIM: Create a binary file with roll number and name. Input a roll

number and search the student with a specific roll number and

display the details.

SOURCE CODE:

import pickle
l=[]
def writing():
y=open("stu.dat","wb")
for i in range(1,3):
n=int(input("roll no"))
na=input("name")
l.append([n,na])
pickle.dump(l,y)
y.close()
def reading():
y=open("stu.dat","rb+")
n=int(input("roll no"))
p=y.tell()
a=pickle.load(y)
na=input("name")
for i in a:
if(i[0]==n):
i[1]=na
y.seek(p)
pickle.dump(a,y)
y.close()
def display():
y=open("stu.dat","rb+")
a1=pickle.load(y)
print(a1)
writing()
reading()
display()
PROGRAM 13

AIM: Write a program to create a binary file with roll number,

name and marks. Input a roll number and update the marks.

SOURCE CODE:

import pickle

l=[]

def wr():

y=open("binary13.dat","wb")

for i in range(0,2):

na = input("enter the name:")

roll=int(input("enter the roll no:"))

ma=int(input("enter the marks"))

l.append([na,roll,ma])

pickle.dump(l,y)

y.close()

def read():

y=open("binary13.dat","rb+")

roll=int(input("enter the roll no of the person whose marks is to be edited:'"))

a=pickle.load(y)

ma=int(input("enter the marks"))

for i in a:

if i[0]==roll:

i[2]=ma

y.close()

def display():

y=open("binary13.dat","rb+")

a1=pickle.load(y)

print(a1)

wr()

read()

display()
OUTPUT:

enter the name:pri

enter the roll no:123

enter the marks55

enter the name:pra

enter the roll no:124

enter the marks60

enter the roll no of the person whose marks is to be edited:'123

enter the marks70

[['pri', 123, 70], ['pra', 124, 60]]


PROGRAM 14

AIM: Program to create the csv file which should contains the employee details and to search the
particular employee based on emp no and display the details.

PROGRAM CODING:

import csv

def addrec():

with open('emp.csv','w',newline='') as f:

b=csv.writer(f)

b.writerow(['Empno','name','salary'])

ans='y'

while ans in 'Yy':

print('Enter employ details below')

eno=int(input("Enter the emp no:"))

n=input("Enter emp name :")

s=int(input("Enter emp salary:"))

b.writerow([eno,n,s])

ans=input("Do you want to add another record(y/n):")

print("record stored")

def searchrec():

with open('emp.csv','r') as f:

b=csv.reader(f)

ans='y'

while ans in 'Yy':

found=False

eno=int(input('Enter the emp no which you want to search:'))

for r in b:

if str(eno) in r:

print("Emp no:",r[0],'\nEmp name :',r[1],'\nEmp salary:',r[2])

found=True
break

if found==False:

print('Record not found')

ans=input("Do you want to search another record(y/n):")

addrec()

searchrec()

OUTPUT

Enter employ details below

Enter the emp no:007

Enter emp name :shah rukh khan

Enter emp salary:5000

Do you want to add another record(y/n):y

Enter employ details below

Enter the emp no:009

Enter emp name :hitler

Enter emp salary:4999

Do you want to add another record(y/n):n

record stored

Enter the emp no which you want to search:007

Emp no: 7

Emp name : shah rukh khan

Emp salary: 5000

Do you want to search another record(y/n):y

Enter the emp no which you want to search:009

Emp no: 9

Emp name : hitler

Emp salary: 4999

Do you want to search another record(y/n):n


PROGRAM 15

AIM: Program to create a CSV file by entering user-id and password, read and search the password
for given user-id.

PROGRAM CODING:

import csv

def addrec():

with open('login.csv','w',newline='') as f:

b=csv.writer(f)

b.writerow(['UserID','Password'])

ans='y'

while ans in 'Yy':

print('Enter Login Details:')

uID=input("Enter the UserID:")

p=input("Enter the Password :")

b.writerow([uID,p])

ans=input("Do you want to add another record(y/n):")

print("record stored")

def searchrec():

with open('login.csv','r') as f:

b=csv.reader(f)

ans='y'

while ans in 'Yy':

found=False

uID=input('Enter the UserID which you want to search:')

for r in b:

if str(uID) in r:

print("User ID:",r[0],'\nPassword :',r[1])

found=True

break
if found==False:

print('Record not found')

ans=input("Do you want to search another record(y/n):")

addrec()

searchrec()

OUTPUT

Enter Login Details below

Enter the UserID:its_nandhaa24

Enter the Password :on the floor baby

Do you want to add another record(y/n):y

Enter Login Details below

Enter the UserID:vxhaxn

Enter the Password :hit it hard baby

Do you want to add another record(y/n):n

record stored

Enter the UserID which you want to search:its_nandhaa24

User ID: its_nandhaa24

Password : on the floor baby

Do you want to search another record(y/n):n


PROGRAM 16

QUESTION

A program to implement the concept of stack.

INPUT

l=eval(input("ENTER list="))

def push():

n=int(input("enter the number"))

l.append(n)

print(l)

def pop():

if l==[] or len(l) == 0:

print('Stack empty')

else:

l.pop()

print(l)

def disp():

if l==[]:

print('The stack is empty')

else:

print(l[::-1])

def peak():

if l==[]:

print("Stack empty")

else:

print(l[-1])

choice = 'yes'

while choice == 'yes':

print('1.push')

print('2.pop')

print('3.display')

print('4.peak')
choice1 = input('Enter WHAT SERVICE U WANT')

if choice1 == '1':

push()

if choice1 == '2':

pop()

if choice1 == '3':

disp()

if choice1 == '4':

peak()

choice = input('do you want to continue')

OUTPUT

ENTER list=[10,20,30,40,50]

1.push

2.pop

3.display

4.peak

Enter WHAT SERVICE U WANT1

enter the number60

[10, 20, 30, 40, 50, 60]

do you want to continueyes

1.push

2.pop

3.display

4.peak

Enter WHAT SERVICE U WANT2

[10, 20, 30, 40, 50]

do you want to continueyes

1.push

2.pop

3.display

4.peak
Enter WHAT SERVICE U WANT3

[50, 40, 30, 20, 10]

do you want to continueyes

1.push

2.pop

3.display

4.peak

Enter WHAT SERVICE U WANT4

50

do you want to continueno


PROGRAM 17

AIM:A Program to create a product table and insert and display data.

SOURCE CODE:

import mysql.connector as dd

y=dd.connect(host="localhost",user="root",password="jirs",charset="utf8",database="school")

x=y.cursor()

def ins():

for i in range(0,3):

pid=int(input("id of the product "))

pname=input('name of product')

price=input('price')

c="insert into product values(%s,%s,%s);"

t=(pid,pname,price)

x.execute(c,t)

y.commit()

ins()

def display():

q="select * from product where pid = 12;"

x.execute(q)

for i in x :

print(i)

display()

OUTPUT:

(12, 'pen', 30.0)


PROGRAM 18:

AIM: A Program to update and display the data after modifying table.

import mysql.connector as dd

y=dd.connect(host="localhost",user="root",password="jirs",charset="utf8",database="school")

x=y.cursor()

def update1 ():

pid=int(input("pid"))

pname=input('pname')

price=input('price')

q="update product set price = %s,pname = %s where pid = %s ;"

t=(price,pname,pid)

x.execute(q,t)

y.commit()

def display():

q="select * from product where price = 100 ;"

x.execute(q)

for i in x :

print(i)

update1()

display()

OUTPUT:

pid12

pnamepp

price100

(12, 'pp', 100.0)


PROGRAM:19

AIM: A Program to display the table then delete a certain row from the table

SOURCE CODE:

import mysql.connector as dd

y=dd.connect(host="localhost",user="root",password="jirs",charset="utf8",database="school")

x=y.cursor()

def delete1():

pid=int(input("enter the product id"))

q="delete from product where pid =%s;"

t=(pid,)

x.execute(q,t)

y.commit()

def display():

q="select * from product;"

x.execute(q)

for i in x :

print(i)

delete1()

display()

OUTPUT:

enter the product id23

(12, 'pp', 100.0)

(34, 'eraser', 50.0)


PROGRAM 20:

AIM :A Program to display the records of the products if the price is more than 100.

SOURCE CODE:

import mysql.connector as dd

y=dd.connect(host="localhost",user="root",password="jirs",charset="utf8",database="school")

x=y.cursor()

def disp2():

q="select * from product where price >= 100;"

x.execute(q)

for i in x :

print(i)

disp2()

OUTPUT:

(12, 'pen', 200.0)


MYSQL QUERIES

PROGRAM 21

TABLE

AIM: To understand the use of mysql database management system using table

QUSTION 1

To display the details about all the Fixed Deposits whose interest rate is NOT ENTERED

select * from bank where INT_RATE IS NULL;

To display the Account number and FD amount of all the Fixed Deposits that are started before 01-
04-2018

SELECT FD_AMOUNT,ACCNO FROM BANK WHERE FD_DATE<'2018-04-01';

To display the customer name and FD amount for all the Fixed deposits which

donot have a number of months as 36.


Select CUST_Name from BANK where Months <> 36;

To display the customer name and FD Amount of all the Fixed deposits for which the FD amount is
less than 500000 and int_rate is more than 7.

Select CUST_Name, FD_amount from bank where FD_Amount<500000 and Int_Rate>7;

select * from bank where year(FD_Date)=2017;

To display the details of all the Fixed Deposits whose FD Amount is in therange

40000-50000

Select * from bank where FD_Amount between 40000 and 50000;

.To display the Customer name and FD amount for all the loans for which
thenumber of months is 24,36 or 48(using in operator)

Select CUST_Name, FD_Amount from bank where Months in (24,36,48);

To display the Account number, customer name and fd_amount for all the FDs

for which the customer name ends with “Sharma”

Select ACCNo, CUST_Name, FD_amount from bank where CUST_Name like "%Sharma";

To display the average FD amount. Label the column as “Average FD Amount”

Select avg(bank) "Average FD Amount" from bank;

To display the total FD amount which started in the year 2018.

Select sum(bank) from bank where year(FD_Date)=2018;

To display the details about all the FDs whose rate of interest is not in the

range 6% to 7%
Select * from bank where Int_Rate not between 6 and 7;

To display the details about all the FDs whose customer name doesn’t contain the character “a”.

Select * from Fixed_Deposits where CUST_Name not like “%a%”;

.To update the Interest rate of all the bank Customers from 6.75 to 6.80

update banks set int_rate =6.80 where int_rate = 6.75;

PROGRAM 22

1. 1. To show all information about the Swimming coaches in the Club

Select * from club where sports = "swimming";


2. To list the names of all coaches with their date of appointment in descending order.

Select coachname, date_of_app from club order by date_of_app desc;

3. To display coach name, pay ,age and bonus(15% of pay)

Select coachname, pay, age, 0.15*pay as bonus from club;

4. To display the distinct sports from the club.

Select distinct sports from club;


5. To display the details about the female coaches in the club

Select * from club where sex = "f";

6. To display the coach names, sports , pay and date_of_app of all the coaches whose

Select coachname, sports, pay, date_of_app from club where coachname like '%n';

7. To display the coach name, sports , age and pay of all the coaches whose pay is in

Select coachname, sports, age, pay from club where pay between 2000 and 2500;
8. To display the details about all the coaches who are above 30 in age and coach a sport
starting with the letter “s”.

Select * from club where age > 30 and sports like 's%';

9. To display the number of coaches available for every sports.

Select sports, count(*) as num_coaches from club group by sports;

10. To display the average Pay given for a coach for every sports activity.

Select sports, avg(pay) as avg_pay from club group by sports;

11. To display the details about all the male coaches who joined after 15th February

Select * from club where sex = "m" and date_of_app > '2022-02-15';
12. To display the coach id , names and age of all the coaches who coach neither Swimming nor
Basketball

Select coach_id, coachname, age from club where sports not in ("swimming", "basketball");

13. To display the names of all the sports in the club which have more than 2 coaches.

Select sports from club group by sports having count(*) > 2;

14. To display the total salary given for male and female coaches in the club.

Select sex, sum(pay) as total_salary from club group by sex;

PROGRAM 23
TABLE:

1. To show all the information about the patients of the cardiology department.

Select *from patients where department = 'cardiology';

2. To list the names of female patients who are either in the orthopaedic or surgery
department.

Select name from patients where sex = 'f' and (department = 'orthopaedic' or department =
'surgery');

3. To display various departments in the hospital.

Select distinct department from patients;


3. To display the number of patients in each department.

Select department, count(*) as num_patients from patients group by department;

4. To display details of all the patients whose name’s second character is “a”.

Select *from patients where name like '_a%';

3. To display the details of all the patients who was admitted in the year 2019.

Select *from patients where year(dateofadm) = 2019;

3. To display the details about all the patients in the reverse alphabetical order of their names.
Select *from patients order by name desc;

8. To display the average charges collected in every department.

Select department, avg(charges) as avg_charges from patients group by department;

8. To display the patient detail whose age is missing.

Select *from patients where age is null;

8. To display the names of the patients who are charged in the range 300 and 400(both
inclusive)

Select name from patients where charges between 300 and 400;
11. To display the number of patients who are aged above 30.

Select count(*) as num_patients from patients where age > 30;

12. To display the names of the department and the number of patients in the department that
have more than one patient.

Select department, count(*) as num_patients from patients group by department having count(*) >
1;

13. To delete the record of the patient “Kush”.

Delete from patients where name = 'kush';

13. To decrease the charges by 5% of all the patients admitted to the ENT department.

Update patients set charges = charges * 0.95 where department = 'ent';

13. To add another column DOCNAME of datatype varchar(20) into the table hospital.

Alter table patients add column docname varchar(20);


PROGRAM 24

1. To display the natural join of the tables items and traders.

Select *from items natural join traders;

2. To display the number of items traded by every Trader.

Select tname, count(*) as num_items from items natural join traders group by tname;
3. To display the Item name, company, trader name and city of all the items

Select iname, company, tname, city from items natural join traders;

4. To display the Item name and Trader name of all the items that are either from Delhi or Mumbai

Select iname, tname from items natural join traders where city in ('delhi', 'mumbai');

5. To display the minimum and maximum price of the item traded by every trader.

Select tname, min(price) as min_price, max(price) as max_price from items natural join traders
group by tname;

5. To display the average price of an item traded by every trader.


Select tname, avg(price) as avg_price from items natural join traders g roup by tname;

5. To display the Item name and trader name of all the items in the alphabetical order
of the item names.

Select iname, tname from items natural join traders order by iname asc;

8. To display the names of the traders whose average price of an item is not more than 20000.

Select tname from traders natural join items where price<20000;

9. To display the details about all the items whose price is in the range

Select *from items natural join traders where price between 10000 and 30000;

9. To display the total number of quantity of items available for every trader.

Select tname, sum(qty) as total_qty from items natural join traders group by tname;
PROGRAM 25

TABLE : DEPT
Q1. To display the department name, code and number of workers in every department.

Select department,dcode,count* from worker primary join dept group by count(wno);

Q2. To display the details about all the workers whose Wno is either 1003, 1005 or 1007

Select * from workers natural join dept where wno in (1003,1005,1007);

Q3. To display the names and date of joining of all the workers in Kolkata

Select name,doj from workers natural join dept where city like “Kolkata”;

Q4. To display the number of male and female workers.

Select count(gender)&quot;no.of workers&quot;,gender from workers group by gender;


Q5. To display Wno,name ,Gender,department in descending order of Wno

Select wno,name,gender,department from workers natural join dept order by wno desc;

Q6. To display the names of all the departments where more than one worker are available.

Select department from workers natural join dept group by dcode having count(wno)>1;

Q7. To display the wno,name,department of all the workers who are born between “1987-01-01”
and “1991-12-01”

Select wno,name,department from workers natural join dept where dob>=”1987-01-01” and
dob<=”1991-12-01”;

Q8. To display wno,name ,department city of all the workers whose name contains the letter “ s”
and who are not in Mumbai and delhi

Select wno,name,department,city from workers natural join dept where name like “%s” and city not
in (“Mumbai”,”Delhi”);

Q9. To count and display the number of male workers who have joined after “1986-01-01”

Select count(wno) from workers where doj>=”1986-01-01” and gender like “male”;
Q10. To display the details of all the male workers in the finance department.

Select * from workers natural join dept where gender like “male” and department like “finance”;
JAIN INTERNATIONAL RESIDENTIAL SCHOOL
KANAKAPURA, KARNATAKA

PROJECT FILE

For
AISSCE 2025 Examination
[As a part of the Computer Science Course]

SUBMITTED BY

VIHAAN GOWDA
JAIN INTERNATIONAL RESIDENTIAL SCHOOL
KANAKAPURA, KARNATAKA

This is to certify that Master VIHAAN GOWDA of class XII D

has satisfactorily completed the project work on the topic

in partial fulfilment of CBSE’s AISSCE Examination 2025.

Name: VIHAAN GOWDA


Reg No.: ……………………………

………………………… ……………………………..
Signature of External Examiner Signature of Internal Examiner

Signature of Principal ………………….


Place: JAKKASANDRA
Date: ……………..
CONTENT
1. Introduction
2. Gratitude
3. System description
4. Java coding
5. Output frames
6. Conclusion
7. Bibliography
INTRODUCTION

Welcome to PyCineBooking, a
movie ticket reservation system
coded entirely in Python.
PyCineBooking is designed to
streamline the movie-going
experience by providing a user-
friendly platform for browsing and
booking tickets. Embrace the
simplicity and efficiency of Python
to bring your cinema experience
to life.
GRATITUDE
I have taken effort in this project. However, it would not
have been possible without the kind support of many
individuals.
I would like to extend my gratitude total of them.
I thank the Almighty for providing me with everything
that I required in completing this project. I am highly
indebted to the teacher in charge Mrs.Deepa Sreehari
for her guidance and constant supervision as well as for
providing necessary information regarding this project
and also for her support in completing this project.
I would like to express my gratitude towards my
parents for their kind cooperation and encouragement
which helped me in the completion of this project.
My thanks and appreciation also go to all those who
have helped me to develop this project and to those
who have willingly helped with whatever they can.

Vihaan Gowda
SYSTEM
DESCRIPTION
PyCineBooking is a Python-based
movie ticket reservation system
designed to simplify the process
of booking movie tickets. The
program enables users to browse
movie listings, check showtimes,
and reserve seats, all within a
streamlined and easy-to-use
interface. Built with Python,
PyCineBooking leverages the
language's robust capabilities to
provide a reliable and efficient
booking experience, catering to
both movie enthusiasts and
theatre managers.
PYTHON CODING

import mysql.connector
from datetime import date

# Database connection settings


config = {
'user': 'root',
'password': 'jirs',
'host': 'localhost',
'charset': 'utf8',
'database': 'movie_booking'
}

# Create a connection to the database


cnx = mysql.connector.connect(**config)
# Create a cursor object to execute SQL queries
cursor = cnx.cursor()
id1 = 0

# Ticket prices
ticket_prices = {
"Normal": 100,
"Premium": 400,
"Director's Cut": 1000
}

def view_movies():
"""View all available movies"""
query = "SELECT * FROM movies"
cursor.execute(query)
movies = cursor.fetchall()
for movie in movies:
print(f"ID: {movie[0]}, Title: {movie[1]}, Description: {movie[2]},
Duration: {movie[3]} minutes, Available Seats: {movie[4]}")

def process_payment(total_amount):
"""Process payment for the booking"""
print(f"Total amount to be paid: ₹{total_amount}")
card_number = input("Enter your card number: ")
expiration_date = input("Enter the expiration date (MM/YY): ")
cvv = input("Enter the CVV: ")
print("Payment processed successfully!")

def book_movie():
"""Book a movie ticket"""
global id1
movie_id = int(input("Enter the movie id: "))
user_name = input("Enter your name: ")

print("Seat layout:")
print(" a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16
a17 a18 a19 a20")
print(" b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 b12 b13 b14 b15
b16 b17 b18 b19 b20")
print(" c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16
c17 c18 c19 c20")
print(" d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 d12 d13 d14 d15
d16 d17 d18 d19 d20")
print(" e1 e2 e3 e4 e5 e6 e7 e8 e9 e10 e11 e12 e13 e14 e15 e16
e17 e18 e19 e20")
print(" f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 f14 f15 f16 f17 f18
f19 f20")
print(" g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 g11 g12 g13 g14 g15 g16
g17 g18 g19 g20")
user_seats = input("Enter your seats (comma-separated):
").split(',')
ticket_types = []

for seat in user_seats:


ticket_type = input(f"Select ticket type for seat {seat}
(Normal/Premium/Director's Cut): ").strip()
if ticket_type in ticket_prices:
ticket_types.append(ticket_type)
else:
print(f"Invalid ticket type for seat {seat}. Please try again.")
return

total_amount = sum(ticket_prices[ticket_type] for ticket_type in


ticket_types)

# Check available seats


query = "SELECT available_seats FROM movies WHERE id = %s;"
cursor.execute(query, (movie_id,))
available_seats = cursor.fetchone()

if available_seats and available_seats[0] >= len(user_seats):


user_food = input("Would you like any snacks? (Y/N):
").strip().upper()
user_food2 = None
if user_food == "Y":
print("Available Snacks:")
print("Pizza, Tandoori Chicken, Pepperoni, Cheese, Paneer
Tikka")
print("Burger , Zesty Chicken Zinger, Terrific Turkey, Jalapeno
Jump")
print("Pasta, Noodles & Tomato, Prima Penne, Romeo &
Linguine")
print("Popcorn, Caramel Delight, Cheesy cheese, Masala
Twist")
user_food2 = input("Select Your Snacks: ")

# Insert booking into the database


yq="select id from bookings;"
cursor.execute(yq)
for i in cursor:
a=i[0]
id=a+1
query = "INSERT INTO bookings (id, movie_id, user_name,
booking_date, seats, snacks, ticket_types) VALUES (%s, %s, %s, %s,
%s, %s, %s);"
cursor.execute(query, (id1, movie_id, user_name, date.today(),
', '.join(user_seats), user_food2, ', '.join(ticket_types)))
cnx.commit()

# Update available seats


update_query = "UPDATE movies SET available_seats =
available_seats - %s WHERE id = %s;"
cursor.execute(update_query, (len(user_seats), movie_id))
cnx.commit()

print("Booking successful!")
process_payment(total_amount)
else:
print("Not enough available seats.")

def cancel_booking():
"""Cancel a movie booking"""
booking_id = int(input("Enter the booking ID: "))
query = "DELETE FROM bookings WHERE id = %s"
cursor.execute(query, (booking_id,))
cnx.commit()
print("Booking cancelled!")

def main():
while True:
print("\nMovie Booking Program")
print("1. View Movies")
print("2. Book a Movie")
print("3. Cancel Booking")
print("4. Exit")
choice = input("Enter your choice: ")
if choice == "1":
view_movies()
elif choice == "2":
book_movie()
elif choice == "3":
cancel_booking()
elif choice == "4":
break
else:
print("Invalid choice. Please try again.")

if __name__ == "__main__":
try:
main()
finally:
cursor.close()
cnx.close()
OUTPUT
CONCLUSION
In conclusion, PyCineBooking
stands as a testament to the power
and versatility of Python in creating
efficient, user-friendly applications.
This movie ticket reservation system
not only streamlines the process of
booking tickets but also enhances
the overall experience for both users
and theater managers. By leveraging
Python's robust features,
PyCineBooking ensures a seamless
and enjoyable cinema journey,
making movie-going more accessible
and convenient for everyone
involved.

BIBLIOGRAPHY

Computer science teacher


Mrs. Deepa Srihari

You might also like