Oct. 7, 2020
5:49 a.m.
On Tue, 6 Oct 2020 at 15:33, Alperen Keleş <alpkeles99@gmail.com> wrote:
Cars have different states, MovingCar, IdleCar, ParkingCar...
Well, IMHO the solution is quite more simple: class Car: def __init__(self): self.state = "parking" def move(self): if self.state != "moving": raise StateException("car can't move!") [...]