Results for “list”

Showing 1–10 of 92

  1. Challenge

    Shared default list

    …remembers samples from earlier calls, because the default list is created once and shared. Predict it, prove the calls share one list, fix it with None as the default, then write a function that hands…

    Fix the code Medium 3 stages functions default values mutable defaults None
  2. Challenge

    Changed the caller's list

    add_reading() appends to the list it receives, so the caller's stored readings change too. Predict the first line, prove both names share one list, fix it by returning a new list, then write a filter…

    Fix the code Medium 3 stages functions lists mutation return
  3. Challenge

    Prove the fix

    …add_sample() that would have caught the shared default list, then add checks that a log passed in is still the one that gets the sample, so a "fix" that breaks that can't pass either.

    Write the code Medium 2 stages testing assert regression tests default values