Which Rows Sit Out?

Machine Learning in CodeEasy+10 XP+10

Which Rows Sit Out?

A teacher wants to hold back some exam papers as a fair test. Each paper has an ID number.

Task: write test_ids(ids, test_size, seed).

  • ids is a list of ID numbers.
  • Split it with train_test_split(ids, test_size=test_size, random_state=seed).
  • Return the IDs that went into the test part, sorted from smallest to largest.

Examples

ids = [101, 102, 103, 104, 105, 106, 107, 108, 109, 110]
test_size = 0.3
seed = 0
returns [103, 105, 109]
ids = list(range(1, 21))
test_size = 0.25
seed = 42
returns [1, 2, 9, 16, 18]

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run