๐Ÿ”ฌ Science

Signal Cleanup

Stardate 55121.3 ยท UES Magnanimous

Briefing

Welcome to the Science station. Lt. Skree has been waiting for you, in the sense that Skree has been standing very still by the console for some time.

The long-range array delivers readings in the order it takes them. Most are below the noise floor. Skree wants every reading above a threshold, in their original order, and has been extremely specific that "above" means strictly greater than: a reading equal to the floor is noise, by definition, and Skree has the definition printed out.

Mission objectives

ARCHIE checks all five every time you run diagnostics.

  • โ€ขKeeps only readings above the threshold, in order
  • โ€ขA reading equal to the threshold is noise and is dropped
  • โ€ขNothing above the threshold: an empty result
  • โ€ขEverything above the threshold: the whole list, unchanged
  • โ€ขNegative thresholds work too
Ask Commander Raghunathan for a hint

Build a new list containing each reading that passes the test. Do not modify the input while walking it. A comprehension or filter is the natural shape; a loop with append is just as good.