An agent that never looks back at what it's already done can't get better over time — the raw material for improvement is a record of what was tried and whether it worked. The first, most basic step toward learning from experience isn't anything clever: it's simply separating what happened into "this worked" and "this didn't," so later questions in this track (retrieving similar past runs, extracting lessons from failures) have something real to draw from.
You're given every trajectory's id and whether it succeeded, in order. Implement classify_and_store(trajectories). Split them into two lists: ids of successful trajectories and ids of failed ones, each preserving the original relative order.
Return (successful_ids, failed_ids).
Two independent list comprehensions, each filtering on the same success flag in opposite directions, is the entire solution — there's no need for a single combined loop with manual appending to two separate lists.
"Preserving relative order" just means: don't sort, don't reverse, don't group by anything other than the success flag. A straightforward filter over the original list already keeps everything in its original relative position.
No results yet
Run your code to check it against the examples, or submit to run every test.