FFFFFFFFFFFFFVG
FFFFFFFFFFFFFVG
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
Examination 2025.
………………………… ……………………………..
Signature of External Examiner Signature of Internal Examiner
PROGRAM 1
AIM
PROGRAM
s=a+b
d=a-b
p=a*b
q=a%b
OUTPUT
The Sum is 36
The Difference is 12
The Quotient is 0
PROGRAM 2
AIM
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:
else:
OUTPUT
Enter a number:256
PROGRAM 3
AIM
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):
else:
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:
p=1
while a>0:
p*=a
a-=1
OUTPUT:
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)
def palindrome():
b=input('enter string:')
if b[::-1]==b:
print('it is a palindrome')
else:
def count():
s=0
c=input('enter string:')
for i in c:
if i=='t':
s+=1
words()
palindrome()
count()
OUTPUT:
Enter string:malayalam
it is a palindrome
PROGRAM 6:
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):
def rectangle(l,b):
def square(s):
def triangle(b,h):
while choice=='yes':
print('1.circle')
print('2.rectangle')
print('3.square')
print('4.triangle')
if choice2==1:
circle(r)
elif choice2==2:
rectangle(l,b)
elif choice2==3:
square(s)
else:
triangle(b,h)
choice=input('do you want to continue? yes/no:')
OUTPUT
1.circle
2.rectangle
3.square
4.triangle
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
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:
cap=cap+1
else:
s=s+1
OUTPUT
QUESTION
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
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
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
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
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):
l.append([na,roll,ma])
pickle.dump(l,y)
y.close()
def read():
y=open("binary13.dat","rb+")
a=pickle.load(y)
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:
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'
b.writerow([eno,n,s])
print("record stored")
def searchrec():
with open('emp.csv','r') as f:
b=csv.reader(f)
ans='y'
found=False
for r in b:
if str(eno) in r:
found=True
break
if found==False:
addrec()
searchrec()
OUTPUT
record stored
Emp no: 7
Emp no: 9
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'
b.writerow([uID,p])
print("record stored")
def searchrec():
with open('login.csv','r') as f:
b=csv.reader(f)
ans='y'
found=False
for r in b:
if str(uID) in r:
found=True
break
if found==False:
addrec()
searchrec()
OUTPUT
record stored
QUESTION
INPUT
l=eval(input("ENTER list="))
def push():
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==[]:
else:
print(l[::-1])
def peak():
if l==[]:
print("Stack empty")
else:
print(l[-1])
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()
OUTPUT
ENTER list=[10,20,30,40,50]
1.push
2.pop
3.display
4.peak
1.push
2.pop
3.display
4.peak
1.push
2.pop
3.display
4.peak
Enter WHAT SERVICE U WANT3
1.push
2.pop
3.display
4.peak
50
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):
pname=input('name of product')
price=input('price')
t=(pid,pname,price)
x.execute(c,t)
y.commit()
ins()
def display():
x.execute(q)
for i in x :
print(i)
display()
OUTPUT:
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()
pid=int(input("pid"))
pname=input('pname')
price=input('price')
t=(price,pname,pid)
x.execute(q,t)
y.commit()
def display():
x.execute(q)
for i in x :
print(i)
update1()
display()
OUTPUT:
pid12
pnamepp
price100
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():
t=(pid,)
x.execute(q,t)
y.commit()
def display():
x.execute(q)
for i in x :
print(i)
delete1()
display()
OUTPUT:
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():
x.execute(q)
for i in x :
print(i)
disp2()
OUTPUT:
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
To display the Account number and FD amount of all the Fixed Deposits that are started before 01-
04-2018
To display the customer name and FD amount for all the Fixed deposits which
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.
To display the details of all the Fixed Deposits whose FD Amount is in therange
40000-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)
To display the Account number, customer name and fd_amount for all the FDs
Select ACCNo, CUST_Name, FD_amount from bank where CUST_Name like "%Sharma";
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”.
.To update the Interest rate of all the bank Customers from 6.75 to 6.80
PROGRAM 22
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%';
10. To display the average Pay given for a coach for every sports activity.
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.
14. To display the total salary given for male and female coaches in the club.
PROGRAM 23
TABLE:
1. To show all the information about the patients of the cardiology department.
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');
4. To display details of all the patients whose name’s second character is “a”.
3. To display the details of all the patients who was admitted in the year 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 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.
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 decrease the charges by 5% of all the patients admitted to the ENT department.
13. To add another column DOCNAME of datatype varchar(20) into the table hospital.
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 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.
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.
Q2. To display the details about all the workers whose Wno is either 1003, 1005 or 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”;
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
………………………… ……………………………..
Signature of External Examiner Signature of Internal Examiner
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
# 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 = []
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