LearnPy Hub
← Classes & Objects problems
Medium

Parking Lot

Write class ParkingLot with a capacity, park(car) (returns False when full or already parked) and leave(car) (returns False if not there). Read the capacity, then commands park X / leave X until END; print ok or no for each, then the cars parked, sorted (or empty).

Input

Capacity, commands, then END.

Output

Lines.

Sample 1

Input
2
park A
park B
park C
leave A
park C
END
Output
ok
ok
no
ok
ok
B C

Sample 2

Input
1
leave X
END
Output
no
empty
solution.py
Output appears here
Parking Lot · Python practice problem · LearnPy Hub