पार्किंग लॉट
कारों की पार्किंग प्रबंधित करने के लिए एक ParkingLot क्लास बनाएं। इस क्लास में कई सुविधाएँ होंगी: यह कार को पार्क कर सके, कार को छोड़ सके, और बचे हुए पार्किंग स्थलों की संख्या बता सके।
एक Car क्लास बनाएं जो पार्किंग लॉट में पार्क की जाने वाली कार का प्रतिनिधित्व करती है।
आपको निम्नलिखित को लागू करना है:
एक
Carक्लास, जिसमेंcar_idएट्रिब्यूट हो: जब कार ऑब्जेक्ट बनाया जाए तो इसे प्रदान किया जाना चाहिए। आगे के सभी कार्यों मेंcar_idका ध्यान रखा जाना चाहिए।एक
ParkingLotक्लास जिसमें: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.
इनपुट | आउटपुट |
|---|---|
| 2 |
| 1 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB