| 1 | from random import randint |
| 2 | |
| 3 | class Train: |
| 4 | |
| 5 | def __init__(slf, trainNo): |
| 6 | slf.trainNo = trainNo |
| 7 | |
| 8 | def book(harry, fro, to): |
| 9 | print(f"Ticket is booked in train no: {harry.trainNo} from {fro} to {to}") |
| 10 | |
| 11 | def getStatus(self): |
| 12 | print(f"Train no: {self.trainNo} is running on time") |
| 13 | |
| 14 | def getFare(self, fro, to): |
| 15 | print(f"Ticket fare in train no: {self.trainNo} from {fro} to {to} is {randint(222, 5555)}") |
| 16 | |
| 17 | |
| 18 | t = Train(12399) |