Results for “len”

Showing 31–40 of 45

  1. 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
  2. Challenge

    Daily mission report

    Turn the day's subsystem status into a fixed-width report for the shift handover, with aligned columns and a totals line, then save the same data as a CSV file with csv.DictWriter for the spreadsheet…

    Write the code Medium 2 stages project formatting f-strings alignment
  3. Challenge

    Line to record

    Extend the feed parser so it stores every reading as a dict with time, sensor, value and unit in a list of records, then let other code pick out one sensor's readings by key.

    Write the code Easy 2 stages dictionaries lists parsing records
  4. Challenge

    Filter the log

    Go through the mission log and build a new list holding only the WARN and ERROR entries with append(), then let a minimum level decide what counts, the way logging tools filter by severity.

    Write the code Medium 2 stages for loop lists append filtering
  5. 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
  6. Challenge

    Roster changes

    Apply a day's crew changes to a list: append() a new member, insert() a backup at position 1, remove() someone who left, then pop() the newest member and print who was reassigned.

    Write the code Easy 2 stages lists append insert remove
  7. Challenge

    Off-by-one slice

    A slice meant to take the number from the container tag CG-0042 gives -004. Predict it, work out where indexes start and where a slice ends, fix it, then slice a sample label yourself.

    Fix the code Easy 3 stages strings slicing indexing off-by-one
  8. 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
  9. 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
  10. 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