Nav jeewan academy
Sr. Sec. School
INFORMATICS PRACTICES
PROJECT FILE
CLASS:- XII ‘B’
PREPARED BY:- GUIDED
BY:-
Mayank Bisht Mr. Prashant
CERTIFICATE
The project report entitled “RAILWAY RESERVATION SYSTEM”
Submitted by Mayank Bisht of class XII ‘B’ for the CBSE Senior
Secondary Examination 2025-26, Class XII for Informatics Practices at
Nav jeewan academy sr. Sec. school has been examined.
SIGNATURE OF EXAMINER
DECLARATION
I hereby declare that the project work entitled
“Railway Reservation System”, submitted to
Department of Informatic practices , N a v
Jeewan academy S r. S e c . School , is
prepared by me.
Mayank Bisht
Class XII ‘B’
ACKNOWLEDGEMENT
I would like to express a deep sense of thanks & gratitude to my
Project guide Mr Prashant for guiding me immensely through the
course of the project. He always evinced keen interest in my work. His
constructive advice & constant motivation have been responsible for
the successful completion of this project.
I also thanks to my parents for their motivation & support. I
must thanks to my class mates for their timely help & support for
completion of this project.
Last but not the least I would like to thanks all those who had
helped directly and indirectly towards the completion of this project.
Mayank
Bisht
Class :XII –A
CONTENTS
1. TABLE STRUCTURE
2. PYTHON CODE
5. INPUT/OUTPUT INTERFACE
6. BIBLIOGRAPHY
Project On “RAILWAY RESERVATION SYSTEM”
DBMS: MySQL
Host : localhost
User: root
Password: root
DataBase: RAIL
Table Structure: (Images Bellow)
PYTHON CODE:
import [Link]
mydb=[Link](host="localhost",user="root",passwd="ro
ot",database="rail");
mycursor=[Link]()
def railresmenu():
print(" \nRailway
Reservation\n ")
print("[Link] Detail")
print("[Link] of Ticket")
print("[Link] of Ticket")
print("[Link] PNR status")
print("[Link] Detail")
print("[Link]")
n=int(input("enter your choice :"))
if(n==1):
traindetail()
elif(n==2):
reservation()
elif(n==3):
cancel()
elif(n==4):
displayPNR()
elif(n==5):
psgdetail()
elif(n==6):
exit(0)
else:
print(" wrong choice ")
def traindetail():
print(" \nTrain Details\n
")
ch='y'
while (ch=='y'):
l=[]
name=input("enter train name :")
[Link](name)
tnum=int(input("enter train number :"))
[Link](tnum)
ac1=int(input("enter number of AC 1 class seats :"))
[Link](ac1)
ac2=int(input("enter number of AC 2 class seats :"))
[Link](ac2)
ac3=int(input("enter number of AC 3 class seats :"))
[Link](ac3)
slp=int(input("enter number of sleeper class seats :"))
[Link](slp)
train=(l)
sql="insert into
traindetail(tname,tnum,ac1,ac2,ac3,slp)values(%s,%s,%s,%s,%s,%s)"
[Link](sql,train)
[Link]()
print("insertion completed")
print("Do you want to insert more train Detail")
ch=input("enter yes/no")
print('\n')
print("===================================================
================")
railresmenu()
def reservation():
print('
\nWELCOME\nto\nTRAIN RESERVATION SYSTEM\n-------------------------
')
pnr=1024
l1=[]
pname=input("enter passenger name=")
[Link](pname)
age=input("enter age of passenger =")
[Link](age)
trainno=input("enter train number")
[Link](trainno)
np=int(input("Enter number of passanger:"))
[Link](np)
print("select a class you would like to travel in")
print("[Link] FIRST CLASS")
print("[Link] SECOND CLASS")
print("[Link] THIRD CLASS")
print("[Link] CLASS")
cp=int(input("Enter your choice:"))
if(cp==1):
amount=np*1000
cls='ac1'
elif(cp==2):
amount=np*800
cls='ac2'
elif(cp==3):
amount=np*500
cls='ac3'
else:
amount=np*350
cls='slp'
[Link](cls)
print("Total amount to be paid:",amount)
[Link](amount)
pnr=pnr+1
print("PNR Number:",pnr)
print("status: confirmed")
sts='conf'
[Link](sts)
[Link](pnr)
train1=(l1)
sql="insert into
passengers(pname,age,trainno,noofpas,cls,amt,status,pnrno)values(%s,
%s,%s,%s,%s,%s,%s,%s)"
[Link](sql,train1)
[Link]()
print("insertion completed")
print("Go back to menu")
print('\n')
print("===================================================
================")
railresmenu()
def cancel():
print(" \nTicket cancel
window\n ")
pnr=input("enter PNR for cancellation of Ticket")
pn=(pnr,)
sql="update passengers set status='deleted' where pnrno=%s"
[Link](sql,pn)
[Link]()
print("Deletion completed")
print("Go back to menu")
print("===================================================
================")
railresmenu()
def displayPNR():
print(" \nPNR Status
window\n ")
pnr=input("enter PNR NUMBER")
pn=(pnr,)
sql="select * from passengers where pnrno=%s"
[Link](sql,pn)
res=[Link]()
print("PNR STATUS are as follows : ")
print("(pname,age,trainno, noofpas,cls,amt,status, pnrno)")
for x in res:
print(x)
print("Go back to menu")
print('\n')
print("===================================================
================")
railresmenu()
def psgdetail():
print(" \nPassengers Detail
Window\n ")
[Link]('select * from passengers')
for i in mycursor:
print(i)
print("Go back to menu")
print('\n')
print("===================================================
================")
railresmenu()
railresmenu()
displayPNR()
cancel()
reservation()
traindetail()
psgdetail()
OUTPUT SCREEN:
Train detail window
Reservation window
Cancellation of ticket window
Display PNR status window
-- passengers details
BIBLIOGRAPHY
1. Sumita Alora (Python)
2. [Link]
3. [Link]