From 90600559bd9aa73cd4b94b8dd9c6fcbc12d0b590 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 29 Apr 2018 18:14:28 +0200 Subject: [PATCH] Remove unnecessary bool checks on patking_lot.py --- .../object_oriented_design/parking_lot/parking_lot.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/solutions/object_oriented_design/parking_lot/parking_lot.py b/solutions/object_oriented_design/parking_lot/parking_lot.py index 12fcd245..7be3df6b 100644 --- a/solutions/object_oriented_design/parking_lot/parking_lot.py +++ b/solutions/object_oriented_design/parking_lot/parking_lot.py @@ -85,9 +85,7 @@ class Level(object): def park_vehicle(self, vehicle): spot = self._find_available_spot(vehicle) - if spot is None: - return None - else: + if spot: spot.park_vehicle(vehicle) return spot @@ -111,10 +109,10 @@ class ParkingSpot(object): self.vehicle = None def is_available(self): - return True if self.vehicle is None else False + return not self.vehicle def can_fit_vehicle(self, vehicle): - if self.vehicle is not None: + if self.vehicle: return False return vehicle.can_fit_in_spot(self)