Results for “len”

Showing 51–60 of 68

  1. Example

    Creating Sets

    Sets store only unique elements without a specific order.

    Audio lesson set unique
  2. Challenge

    Index by ID

    Build a dict that maps every cargo ID to its record, so any item is found with one lookup instead of a search through the list, then answer a list of requests, including an ID that isn't on the…

    Write the code Medium 2 stages dictionaries indexing lookup in
  3. Challenge

    Mass by category

    Add up the cargo mass of each category into a dict with totals[category] = totals.get(category, 0) + mass, then list the categories from heaviest to lightest with their share of the load.

    Write the code Medium 2 stages dictionaries grouping get sorted
  4. Challenge

    Never-ending wait

    …it never did: No lock after 6 s After the loop, second < len(strengths) tells the two endings apart. Put the length check first in the while condition.

    Fix the code Easy 3 stages while loop infinite loop counter and