-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTrain_Ticket_Booking.py
More file actions
39 lines (34 loc) · 1.39 KB
/
Train_Ticket_Booking.py
File metadata and controls
39 lines (34 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import random
class Train:
def __init__(self,num):
self.num=num
def Reservation(self):
self.result=[]
self.identity=[]
for i in range(0,self.num):
print(f"Please enter the details for <<< {i} >>> no seat")
self.a=input("Please Enter your full name:-")
x=input("Enter your aadhar card numer:-")
self.b=random.randint(1,100)
self.result.append({self.b:self.a})
self.identity.append({self.b:self.a})
self.identity.append({"addhar no":x})
print("Congratulations,Your reservation is Done, Your seat number with Name:-",self.result)
def Local(self):
n=100
a=n-self.num
if a>0:
print(f'Congratulations, You are successfully book your {self.num} tickets \n And the total remaining seats are {a}')
elif a<=0:
print(f"Oops! Sorry you are late seats are full")
def Identity(self):
print(f"The identity of reserved person :- {self.identity}")
if __name__ == "__main__":
obj=Train(int(input("Enter the Total number of tickets you want to book:- ")))
a=int(input(" 1] Reservation \n 2] Local \n Enter the choice for ticket :-"))
if a == 1:
obj.Reservation()
print("*"*88)
obj.Identity()
if a == 2:
obj.Local()