Update parking_lot.py

Fixed the typo where spot size was not being assigned and cleaned up the supers
pull/782/head
shivral 2023-06-15 10:17:20 +05:30 committed by GitHub
parent a07e261677
commit 5d01ff2b34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@ class Vehicle(metaclass=ABCMeta):
def __init__(self, vehicle_size, license_plate, spot_size):
self.vehicle_size = vehicle_size
self.license_plate = license_plate
self.spot_size
self.spot_size=spot_size
self.spots_taken = []
def clear_spots(self):
@ -33,7 +33,7 @@ class Vehicle(metaclass=ABCMeta):
class Motorcycle(Vehicle):
def __init__(self, license_plate):
super(Motorcycle, self).__init__(VehicleSize.MOTORCYCLE, license_plate, spot_size=1)
super().__init__(VehicleSize.MOTORCYCLE, license_plate, spot_size=1)
def can_fit_in_spot(self, spot):
return True
@ -42,7 +42,7 @@ class Motorcycle(Vehicle):
class Car(Vehicle):
def __init__(self, license_plate):
super(Car, self).__init__(VehicleSize.COMPACT, license_plate, spot_size=1)
super().__init__(VehicleSize.COMPACT, license_plate, spot_size=1)
def can_fit_in_spot(self, spot):
return spot.size in (VehicleSize.LARGE, VehicleSize.COMPACT)
@ -51,7 +51,7 @@ class Car(Vehicle):
class Bus(Vehicle):
def __init__(self, license_plate):
super(Bus, self).__init__(VehicleSize.LARGE, license_plate, spot_size=5)
super().__init__(VehicleSize.LARGE, license_plate, spot_size=5)
def can_fit_in_spot(self, spot):
return spot.size == VehicleSize.LARGE