Unassigned Locker Numbers
Problem
A gym assigns sequentially numbered lockers to members, but some numbers in the run are currently empty. The `locker` DataFrame has `locker_no` (an assigned locker number) and `holder_name`.\n\nReturn every locker number between 1 and the largest assigned `locker_no` that is **not** currently assigned. Name the single output column `gap_no`.
Input data
Example rows — the live problem includes the full dataset.
locker
| locker_no | holder_name |
|---|---|
| 1 | Hugo |
| 4 | Iris |
| 5 | Jonas |
Expected output
Your answer should return 2 rows with the columns gap_no.
Starter code (Pandas (Python))
import pandas as pd
def unassigned_lockers(locker) -> pd.DataFrame:
# Your code here
return lockerSolve this Pandas question free
Write Pandas (Python) and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock