AnalystPath

Missing Lesson Steps

PandasHardSenior level~10 min

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
lesson_idstep_total
13
22
34
completedstep
lesson_idstep_no
12
31
32
33
34

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 lesson

Solve 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

Related Pandas questions