Missing Lesson Steps
Problem
An online course platform breaks each lesson into a fixed number of sequentially-numbered steps.
A `lesson` DataFrame has `lesson_id` and `step_total`; a lesson with `step_total = n` has steps numbered `1..n`. A `completedstep` DataFrame has `lesson_id` and `step_no`, one row per step a learner finished.
For every lesson, return the steps that were **never** completed, as `lesson_id` and `step_no`, in any order.
Input data
Example rows — the live problem includes the full dataset.
| lesson_id | step_total |
|---|---|
| 1 | 3 |
| 2 | 2 |
| 3 | 4 |
| lesson_id | step_no |
|---|---|
| 1 | 2 |
| 3 | 1 |
| 3 | 2 |
| 3 | 3 |
| 3 | 4 |
Expected output
Your answer should return 4 rows with the columns lesson_id, step_no.
Starter code (Pandas (Python))
import pandas as pd
def missing_lesson_steps(lesson: pd.DataFrame, completedstep: pd.DataFrame) -> pd.DataFrame:
# Your code here
return lessonSolve 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