MCPcopy Create free account
hub / github.com/CodeWithHarry/The-Ultimate-Python-Course / Train

Class Train

Chapter 10 - PS/06_problem6.py:3–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1from random import randint
2
3class 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
18t = Train(12399)

Callers 1

06_problem6.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected