SlideShare a Scribd company logo
1 of 21
Download to read offline
ALL INDIA SENIOR SECONDARY CERTIFICATE EXAMINATION
D.A.V PUBLIC SCHOOL
P.G.C BIHARSHARIF (NALANDA)
SUBMITTED By-
SUPERVISED By -
SESSION:- 2022-2023
Mr.pankaj kr.Sniha Rajnit kumar
BIOLOGY PRACTICES
PROJECT
CLASS:- XII
ROLL:-
CERTIFICATE
Mr. Gyan Ranjan Sinha
(Subject teacher)
This is to certify that RAJ KAMAL, a
student of class XII, has successfully
completed the project Railway Ticket
Reservation system under the guidance of
Mr. Gyan Ranjan Sinha during the year
2022-2023 investigatory project
conducted
by AISSCE, New Delhi
Mr V.K. Pathak
(Principal)
ACKNOWLEDGMENT
I wish to express our sincere gratitude to Mr.
Gyan Ranjan Sinha of computer department
D.A.V. Public School for providing us an
opportunity and the encouragement to do this
investigatory project work onRailway Ticket
Reservation system.
I am very much thankful to him for his proper
guidance and support. This project was not
possible without the resources that we got from
our school. I am also thankful to my parents and
friends for extensive support and their blessings.
Class – XII (Principal)
D.A.V. Public School
Bihar Sharif (Nalanda)
RAJ KAMAL V.K. Pathak
CONTENTS
1. AIM
2. Prerequisites
3. Steps for completion of
some of the prerequisites
4. WORKING DESCRIPTION
5.CODING
6.OUTPUT
AIM
The main objective of the Python
Project on Railway Ticket Reservation
system is to manage the details of
Booking, Timetable, Trains, Stations, Fare. It
manages all the information about Booking,
Customers, Fare, Booking. The project is totally
built at administrative end and thus only the
administrator is guaranteed the access. The
purpose of the project is to build an application
program to reduce the manual work for managing
the Booking, Timetable, customers, Trains. It
tracks all the details about the Trains, Stations,
Fare.
Prerequisites
1. Python with mysql.connector
2. MySQL
3. Database named “rail”
4. Tables named “traindetail” and
“passengers” inside of rail
database
Steps for completion
of some of the
prerequisites
 INSTALLING mysql.connector
Go to python terminal and
use pip install mysql-
connector-python .
 Creating required database and
tables
For Database:
In MySQL, create database ”rail”
with command:
Create database rail;
For Tables:
Create table named traindetail
with following fields
Now, create a table named passengers
with following fields
WORKING
DESCRIPTION
This program consists of FIVE
options as follows:
1.Train Detail
2. Reservation of Ticket
3. Cancellation of Ticket
4. Display PNR status
5.Quit
CODING
import mysql.connector
import sys
pnr=1024
mydb=mysql.connector.connect(host="localhost",
user="root",passwd="root", database="rail");
mycursor=mydb.cursor ()
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 ()
elif (n==5):
sys.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 to 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")
print("Do you want to insert more train Detail")
ch=input("enter yes/no : ")
print('n'*10)
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):
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, noofpas, 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)
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)
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()
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'*10)
railresmenu()
OUTPUT
Selection menu
1. Entering train details
2. Reservation of Ticket
3. Cancellation of Ticket
4. Display PNR status
5.Quit

More Related Content

Similar to KUMARPAWAN (2)-1-1.pdf

Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Self-employed
 
Online Bus Reservation
Online Bus ReservationOnline Bus Reservation
Online Bus ReservationAstha Patel
 
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SADProject report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SADNitesh Singh
 
Railway reservation(c++)
Railway reservation(c++)Railway reservation(c++)
Railway reservation(c++)Pusan Sen
 
Cs investrigatory project
Cs investrigatory projectCs investrigatory project
Cs investrigatory projectHGIUO
 
projects2021C11.pdf
projects2021C11.pdfprojects2021C11.pdf
projects2021C11.pdfAjaybPawara
 
Bus transportation query report
Bus transportation query reportBus transportation query report
Bus transportation query reportSudhanshu Moolya
 
computer project by sandhya ,shital,himanshi.pptx
computer project by sandhya ,shital,himanshi.pptxcomputer project by sandhya ,shital,himanshi.pptx
computer project by sandhya ,shital,himanshi.pptxIshooYadav
 
Rakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third YearRakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third YearDezyneecole
 
5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...
5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...
5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...Hossam Shafiq I
 
Online Bus Reservation System
Online Bus Reservation SystemOnline Bus Reservation System
Online Bus Reservation SystemSiva Rushi
 
Library Management Python, MySQL
Library Management Python, MySQLLibrary Management Python, MySQL
Library Management Python, MySQLDarshit Vaghasiya
 
CCE management system
CCE management systemCCE management system
CCE management systemTrish004
 
Computer project final for class 12 Students
Computer project final for class 12 StudentsComputer project final for class 12 Students
Computer project final for class 12 StudentsShahban Ali
 
Railway management system, database mini project
Railway management system, database mini projectRailway management system, database mini project
Railway management system, database mini projectshashank reddy
 
Graduation project Book (Self-Driving Car)
Graduation project Book (Self-Driving Car)Graduation project Book (Self-Driving Car)
Graduation project Book (Self-Driving Car)ahmedshehata133
 
Railway reservation(c++ project)
Railway reservation(c++ project)Railway reservation(c++ project)
Railway reservation(c++ project)Debashis Rath
 
InternshipReportFormat.docx
InternshipReportFormat.docxInternshipReportFormat.docx
InternshipReportFormat.docxssuser2fe708
 

Similar to KUMARPAWAN (2)-1-1.pdf (20)

Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12Computer Science Investigatory Project Class 12
Computer Science Investigatory Project Class 12
 
Online Bus Reservation
Online Bus ReservationOnline Bus Reservation
Online Bus Reservation
 
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SADProject report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
 
Railway reservation(c++)
Railway reservation(c++)Railway reservation(c++)
Railway reservation(c++)
 
Cs investrigatory project
Cs investrigatory projectCs investrigatory project
Cs investrigatory project
 
projects2021C11.pdf
projects2021C11.pdfprojects2021C11.pdf
projects2021C11.pdf
 
Bus transportation query report
Bus transportation query reportBus transportation query report
Bus transportation query report
 
computer project by sandhya ,shital,himanshi.pptx
computer project by sandhya ,shital,himanshi.pptxcomputer project by sandhya ,shital,himanshi.pptx
computer project by sandhya ,shital,himanshi.pptx
 
Presentation v2
Presentation v2Presentation v2
Presentation v2
 
Rakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third YearRakesh Bijawat , BCA Third Year
Rakesh Bijawat , BCA Third Year
 
5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...
5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...
5-Modal Split & Traffic Assignment-( Transportation and Traffic Engineering D...
 
Online Bus Reservation System
Online Bus Reservation SystemOnline Bus Reservation System
Online Bus Reservation System
 
Library Management Python, MySQL
Library Management Python, MySQLLibrary Management Python, MySQL
Library Management Python, MySQL
 
CCE management system
CCE management systemCCE management system
CCE management system
 
Computer project final for class 12 Students
Computer project final for class 12 StudentsComputer project final for class 12 Students
Computer project final for class 12 Students
 
Railway management system, database mini project
Railway management system, database mini projectRailway management system, database mini project
Railway management system, database mini project
 
Graduation project Book (Self-Driving Car)
Graduation project Book (Self-Driving Car)Graduation project Book (Self-Driving Car)
Graduation project Book (Self-Driving Car)
 
Online final report
Online final reportOnline final report
Online final report
 
Railway reservation(c++ project)
Railway reservation(c++ project)Railway reservation(c++ project)
Railway reservation(c++ project)
 
InternshipReportFormat.docx
InternshipReportFormat.docxInternshipReportFormat.docx
InternshipReportFormat.docx
 

Recently uploaded

Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMANIlamathiKannappan
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with CultureSeta Wicaksana
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756dollysharma2066
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxpriyanshujha201
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataExhibitors Data
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.Aaiza Hassan
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Centuryrwgiffor
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfAdmir Softic
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...Any kyc Account
 
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...anilsa9823
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Servicediscovermytutordmt
 
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Lviv Startup Club
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMRavindra Nath Shukla
 
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒anilsa9823
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableDipal Arora
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityEric T. Tung
 

Recently uploaded (20)

Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 
A DAY IN THE LIFE OF A SALESMAN / WOMAN
A DAY IN THE LIFE OF A  SALESMAN / WOMANA DAY IN THE LIFE OF A  SALESMAN / WOMAN
A DAY IN THE LIFE OF A SALESMAN / WOMAN
 
Organizational Transformation Lead with Culture
Organizational Transformation Lead with CultureOrganizational Transformation Lead with Culture
Organizational Transformation Lead with Culture
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
M.C Lodges -- Guest House in Jhang.
M.C Lodges --  Guest House in Jhang.M.C Lodges --  Guest House in Jhang.
M.C Lodges -- Guest House in Jhang.
 
Famous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st CenturyFamous Olympic Siblings from the 21st Century
Famous Olympic Siblings from the 21st Century
 
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdfDr. Admir Softic_ presentation_Green Club_ENG.pdf
Dr. Admir Softic_ presentation_Green Club_ENG.pdf
 
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
KYC-Verified Accounts: Helping Companies Handle Challenging Regulatory Enviro...
 
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
Lucknow 💋 Escorts in Lucknow - 450+ Call Girl Cash Payment 8923113531 Neha Th...
 
Call Girls in Gomti Nagar - 7388211116 - With room Service
Call Girls in Gomti Nagar - 7388211116  - With room ServiceCall Girls in Gomti Nagar - 7388211116  - With room Service
Call Girls in Gomti Nagar - 7388211116 - With room Service
 
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
Yaroslav Rozhankivskyy: Три складові і три передумови максимальної продуктивн...
 
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Hebbal Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Monte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSMMonte Carlo simulation : Simulation using MCSM
Monte Carlo simulation : Simulation using MCSM
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒VIP Call Girls In Saharaganj ( Lucknow  ) 🔝 8923113531 🔝  Cash Payment (COD) 👒
VIP Call Girls In Saharaganj ( Lucknow ) 🔝 8923113531 🔝 Cash Payment (COD) 👒
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service AvailableCall Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
Call Girls Pune Just Call 9907093804 Top Class Call Girl Service Available
 
How to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League CityHow to Get Started in Social Media for Art League City
How to Get Started in Social Media for Art League City
 

KUMARPAWAN (2)-1-1.pdf

  • 1. ALL INDIA SENIOR SECONDARY CERTIFICATE EXAMINATION D.A.V PUBLIC SCHOOL P.G.C BIHARSHARIF (NALANDA) SUBMITTED By- SUPERVISED By - SESSION:- 2022-2023 Mr.pankaj kr.Sniha Rajnit kumar BIOLOGY PRACTICES PROJECT CLASS:- XII ROLL:-
  • 2. CERTIFICATE Mr. Gyan Ranjan Sinha (Subject teacher) This is to certify that RAJ KAMAL, a student of class XII, has successfully completed the project Railway Ticket Reservation system under the guidance of Mr. Gyan Ranjan Sinha during the year 2022-2023 investigatory project conducted by AISSCE, New Delhi Mr V.K. Pathak (Principal)
  • 3. ACKNOWLEDGMENT I wish to express our sincere gratitude to Mr. Gyan Ranjan Sinha of computer department D.A.V. Public School for providing us an opportunity and the encouragement to do this investigatory project work onRailway Ticket Reservation system. I am very much thankful to him for his proper guidance and support. This project was not possible without the resources that we got from our school. I am also thankful to my parents and friends for extensive support and their blessings. Class – XII (Principal) D.A.V. Public School Bihar Sharif (Nalanda) RAJ KAMAL V.K. Pathak
  • 4. CONTENTS 1. AIM 2. Prerequisites 3. Steps for completion of some of the prerequisites 4. WORKING DESCRIPTION 5.CODING 6.OUTPUT
  • 5. AIM The main objective of the Python Project on Railway Ticket Reservation system is to manage the details of Booking, Timetable, Trains, Stations, Fare. It manages all the information about Booking, Customers, Fare, Booking. The project is totally built at administrative end and thus only the administrator is guaranteed the access. The purpose of the project is to build an application program to reduce the manual work for managing the Booking, Timetable, customers, Trains. It tracks all the details about the Trains, Stations, Fare.
  • 6. Prerequisites 1. Python with mysql.connector 2. MySQL 3. Database named “rail” 4. Tables named “traindetail” and “passengers” inside of rail database
  • 7.
  • 8. Steps for completion of some of the prerequisites  INSTALLING mysql.connector Go to python terminal and use pip install mysql- connector-python .  Creating required database and tables For Database: In MySQL, create database ”rail” with command: Create database rail;
  • 9. For Tables: Create table named traindetail with following fields Now, create a table named passengers with following fields
  • 10.
  • 11. WORKING DESCRIPTION This program consists of FIVE options as follows: 1.Train Detail 2. Reservation of Ticket 3. Cancellation of Ticket 4. Display PNR status 5.Quit
  • 12. CODING import mysql.connector import sys pnr=1024 mydb=mysql.connector.connect(host="localhost", user="root",passwd="root", database="rail"); mycursor=mydb.cursor () 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 () elif (n==5):
  • 13. sys.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 to 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()
  • 14. print("insertion completed") print("Do you want to insert more train Detail") ch=input("enter yes/no : ") print('n'*10) 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):
  • 15. 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, noofpas, 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)
  • 16. 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) 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() 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'*10) railresmenu()
  • 18. 1. Entering train details
  • 20. 3. Cancellation of Ticket 4. Display PNR status