Results for “lists”

Showing 31–40 of 92

  1. Challenge

    Missing index

    readings[5] on a list of five readings stops with an IndexError. Predict it, work out the valid indexes with len(), fix it with [-1], then print the first, middle and last readings for any length.

    Fix the code Easy 3 stages lists indexing IndexError len
  2. Challenge

    Edge cases

    Write assert checks for mean(): an ordinary list and a list with one value first, then the edge cases, an empty list that should give None and lists with negative values, so broken copies of the…

    Write the code Medium 2 stages testing assert edge cases None
  3. Challenge

    Shift rota

    …the rota, and check its own work. In turn Build rota , a list of (day, shift, name) tuples for every shift of the week, in order, taking the crew in turn. Print one line per day, then count how many…

    Write the code Hard 2 stages project scheduling lists tuples
  4. Challenge

    Manifest diff

    …unpacked. The loading supervisor doesn't want to read both lists side by side: she wants to know what changed. Work out what was added and what was removed, then how much stayed the same. Added and…

    Write the code Easy 2 stages sets difference intersection sorted
  5. Challenge

    Manifest validator

    Write problems(item), which lists everything wrong with one cargo item: missing fields, a mass that isn't a number, is 0 or is over the limit. Print a pass or fail line per item, then catch duplicate…

    Write the code Medium 2 stages project validation dictionaries functions
  6. Challenge

    Paged results

    Merge three pages of launch results into one list with extend(), then fetch page after page in a while loop and stop at the first short page, the way paginated API responses are read.

    Write the code Medium 2 stages for loop while loop extend break