Editor

Pass and Fail Lists

#512 · Lists · Beginner · 25 XP · about 4 min

Write split_marks(marks, pass_mark) that splits a list of test marks into two lists: the marks that pass (pass_mark or more) and the marks that do not. Return both lists in a tuple (passed, failed), each keeping the marks in their original order.

Examples

split_marks([45, 80, 32, 60], 40)  # returns ([45, 80, 60], [32])
split_marks([10, 20], 50)          # returns ([], [10, 20])
split_marks([], 40)                # returns ([], [])

A mark equal to pass_mark passes.

Fastest solvers

Leaderboard

First solves only, ranked by stars and then time.