By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Complete the code challenge below. Read the instructions carefully and use the integrated editor on the right to write and run your solution.
This is the core of Module 2. You implement the stopping rule and the critique parser that turns a model's review into a list of edits.
reflection_loop(scores, threshold=0.8, max_rounds=3) — given the critic's score for each successive draft, return the 1-based draft number that first reaches threshold, or 0 if none does within max_rounds drafts. Never examine more than max_rounds entries.extract_actions(critique) — return the action lines from a critique: lines starting with - with the marker and surrounding whitespace stripped. Ignore blank lines and headings (lines starting with #). Preserve order.Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.