SHREE (1)
SHREE (1)
SUBMITTED BY:
NAME OF THE STUDENT : S.KEERTHANA SHREE
CLASS & SEC : XII-F
EXAM NO :12F35
SUBMITTED TO :
TEACHER NAME: Ms. G. MOHANA SUNDARI M.Tech, B.Ed.
DESIGNATION: PGT(CS)
2
VELAMMALVIDYALAYA
ALAPAKKAM
Name : Batch No :
Class : Regd. No :
Certificate
Certified that this is a
bonafide Record of
Practical work done by
Mr/Miss. in the
Teacher
Laboratory during – In- Charge
the year _
MS. G MOHANA SUNDARI
ACKNOWLEDGEMENT
In the accomplishment of this project successfully, many people have bestowed their
blessings and heart pledged support upon me, I take this opportunity to express my
gratitude to all, who have been instrumental in the successful completion of this project.
I would also like to thank my parents, friends and all the members who contributed
to this project was vital for the success of the project.
CONTENTS
1 Introduction 5
3 Feasibility of Study 7
5 Source Code 10
6 Output 15
8 Conclusion 20
9 Bibliography 21
5
INTRODUCTION
➢ Railway ticket reservation system is very useful software used for purpose of ticket
➢ This project is very useful for the people to book their railway tickets in digital ways,
➢ This railway ticket reservation project was only developed using Python
Programming language.
➢ The need of this system arose because as it is known that the fact, India has the largest
➢ By computerizing it, we will be able to overcome more time and able to make it more
efficient.
➢ Online reservation has made the process for the reservation of seats very much easier
The objective of this project is to let the students apply the programming knowledge into
a real- world situation/problem and exposed the students how programming skills helps in
developing a good software.
FEASIBILITY OF STUDY
➢ Economic Feasibility :
The Project is absolutely economical as it doesn’t really require time toSpend . it had
he utmost concentration on making the project more user friendly. Thereby, it is made
possible that anyonewith a normal device with Python and MYSQL in it can use it.
➢ Technical Feasibility :
The Project must be technical feasible as to ensure that the project is proceeding or not.
It is takenutmost care use an ensuring platform Python and MYSQL which is both
developable and technological. As the technologies used are safe and user friendly,
the project is technically feasible
➢ Operational Feasibility :
The project is checked to ensure that it is user friendly and the software meets all
the needs of a person to use, makes it a operationally feasible one.
8
DATABASE DETAILS
9
SOURCE CODE
import pnr=2023
mydb=mysql.connector.connect(host="localhost",user="root",passwd="1234",database="rail");
mycursor=mydb.cursor()
def intro():
print('\n**********************WELCOMETO
IRCTC*****************************')
print('```````````````````````LIFELINE OF THE NATION``````````````````````\n')
intro()
def railresmenu():
print("Railway Reservation ")
print("1.Train Detail")
print("2.Reservation of Ticket")
print("3.Cancellation of Ticket")
print("4.Display PNR status")
print("5.Quit")
n=int(input("enter your choice:"))
if(n==1):
traindetail()
elif(n==2):
reservation()
elif(n==3):
cancel()
elif(n==4):
displayPNR()
10
elif(n==5):
exit(0)
else:
print("wrong choice")
def traindetail():
print("Train Details")
ch='y'
while (ch=='y'):
l=[]
name=input("enter train name :")
l.append(name)
tnum=int(input("enter train number :"))
l.append(tnum)
ac1=int(input("enter number of AC 1 class seats:"))
l.append(ac1)
ac2=int(input("enter number of AC 2 class seats:"))
l.append(ac2)
ac3=int(input("enter number of AC 3 class seats:"))
l.append(ac3)
slp=int(input("enter number of sleeper class seats:"))
l.append(slp)
train=(l)
sql="insert into traindetail
(tname,tnum,ac1,ac2,ac3,slp)values(%s,%s,%s,%s,%s,%s)"
mycursor.execute(sql,train)
mydb.commit()
print("insertion completed")
11
print("=================================================================
==")
railresmenu()
def reservation():
global pnr
l1=[]
pname=input("enter passenger name:")
l1.append(pname)
age=input("enter age of passenger:")
l1.append(age)
trainno=input("enter train number:")
l1.append(trainno)
np=int(input("Enter number of passanger:"))
l1.append(np)
print("select a class you would like to travel in")
print("1.AC FIRST CLASS")
print("2.AC SECOND CLASS")
print("3.AC THIRD CLASS")
print("4.SLEEPER CLASS")
cp=int(input("Enter your choice:"))
if(cp==1):
amount=np*1000
cls='ac1'
elif(cp==2):
12
amount=np*800
cls='ac2'
elif(cp==3):
amount=np*500
cls='ac3'
else:
amount=np*350
cls='slp'
l1.append(cls)
print("Total amount to be paid:",amount)
l1.append(amount)
pnr=pnr+1
print("PNR Number:",pnr)
print("status: confirmed")
sts='conf'
l1.append(sts)
l1.append(pnr)
train1=(l1)
sql="insert into
passengers(pname,age,trainno,noofpass,cls,amt,status,pnrno)values(%s,%s,%s,%s,%s,%s,%s,%s)
"
mycursor.execute(sql,train1)
mydb.commit()
print("insertion completed")
print("Go back to menu")
print('\n' *10)
13
print("=================================================================
==")
railresmenu()
def cancel():
print("Ticket cancel window")
pnr=input("enter PNR for cancellation of Ticket")
pn=(pnr,)
sql="update passengers set status='deleted' where pnrno=%s"
mycursor.execute(sql,pn)
mydb.commit()
print("Deletion completed")
print("Go back to menu")
print('\n' *10)
print("=================================================================
==")
railresmenu()
def displayPNR():
print("PNR STATUS window")
pnr=input("enter PNR NUMBER:")
pn=(pnr,)
sql="select * from passengers where pnrno=%s"
mycursor.execute(sql,pn)
res=mycursor.fetchall()
#mydb.commit()
print("PNR STATUS are as follows : ")
14
print("=================================================================
==")
railresmenu()
railresmenu()
15
OUTPUT
TRAIN DETAILS
16
RESERVATION OF TICKET
17
CANCELLATION OF TICKET
18
Hardware Requirements
Software Requirements
I. Windows OS
II. Python
III. MYSQL
IV. Notepad
20
CONCLUSION
Thereby, we conclude that this project has not helped the common citizen for making
reservations for their Railway ticket saving their time, but also helped many existing and
upcoming registration which take up bookings for the Railway ticket. The work has become
fully automated and any information regarding the booking or the booking, itself can be
done by clicking a single button at your hands rather than standing in queues and waiting for
your turn. User friendliness is a must that is the user must get the details without complicated
searching procedures
21
BIBLIOGRAPHY
Textbooks:
Computer Science with python by SumitaArora
Computer Science with python by PreetiArora
Websites:
https://en.wikipedia.org/
http://python.mykvs.in/