Parking Lot
Create a ParkingLot class that manages the parking of cars. This class has several functionalities: it should be able to park a car, release a car, and report the number of parking spots left.
Create a Car class that represents a car that can be parked in the parking lot.
You need to implement the following:
A
Carclass, with acar_idattribute: should be provided when the car object is created. All the following operations should take into account thecar_id.A
ParkingLotclass with:total_spotsattribute: the total number of parking spots in the parking lot, which should be provided when the parking lot object is created.park(car)method: parks aCarobject in the parking lot. If the parking lot is full, it should printParking lot is full.release(car)method: releases aCarfrom the parking lot. If the car is not in the parking lot, it should printCar not found in the parking lot.spots_left()method: returns an integer representing the number of available parking spots in the parking lot.
Input | Output |
|---|---|
| 2 |
| 1 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB