Bird
0
0
LLDsystem_design~10 mins

Class identification (ParkingLot, Floor, Spot, Vehicle) in LLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define the class that represents the entire parking structure.

LLD
class [1]:
    def __init__(self):
        self.floors = []
Drag options to blanks, or click blank then click option'
AParkingLot
BVehicle
CSpot
DFloor
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing Floor or Spot instead of ParkingLot.
2fill in blank
medium

Complete the code to define the class that represents a single level inside the parking lot.

LLD
class [1]:
    def __init__(self, level_number):
        self.level_number = level_number
        self.spots = []
Drag options to blanks, or click blank then click option'
AVehicle
BFloor
CSpot
DParkingLot
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing Floor with Spot or ParkingLot.
3fill in blank
hard

Fix the error in the class name that represents a parking space for a vehicle.

LLD
class [1]:
    def __init__(self, spot_id):
        self.spot_id = spot_id
        self.is_occupied = False
Drag options to blanks, or click blank then click option'
ASpot
BFloor
CVehicle
DParkingLot
Attempts:
3 left
💡 Hint
Common Mistakes
Using Vehicle or Floor instead of Spot.
4fill in blank
hard

Fill both blanks to define the class and attribute for a vehicle parked in the lot.

LLD
class [1]:
    def __init__(self, [2]):
        self.license_plate = [2]
Drag options to blanks, or click blank then click option'
AVehicle
Bspot_id
Clicense_plate
DFloor
Attempts:
3 left
💡 Hint
Common Mistakes
Using Floor or Spot as class name.
Using spot_id as vehicle attribute.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension mapping spot IDs to occupancy status on a floor.

LLD
occupancy = { [1]: [2].is_occupied for [3] in floor.spots }
Drag options to blanks, or click blank then click option'
Aspot.spot_id
Bspot
Dfloor
Attempts:
3 left
💡 Hint
Common Mistakes
Using floor instead of spot in the loop.
Using spot_id as variable name in loop.