Results for “return none”

Showing 1–10 of 26

  1. Challenge

    sort() returns None

    crew = crew.sort() leaves the roster as None. Predict it, find out what sort() really gives back, fix it by sorting in place, then sort readings from highest to lowest and keep the top three.

    Fix the code Easy 3 stages lists sort None in place
  2. Challenge

    Parser function

    …parser from "Line to record" into parse_line(line), which returns the record dict, then let it return None for blank, comment and damaged lines so the loop only keeps real records.

    Fix the code Medium 2 stages functions return dictionaries None
  3. Challenge

    Prints instead of returns

    to_kelvin() prints its result instead of returning it, so the caller gets None. Predict the last line, find out what the function gives back, fix it with return, then write a conversion function that…

    Fix the code Easy 3 stages functions return print None
  4. Challenge

    Silent branch

    status_light() returns None for Scrub because that branch sets a variable but never returns it. Predict the last line, find which statuses give None, make every path return, then write a function…

    Fix the code Easy 3 stages functions return None branches
  5. Challenge

    Test the parser

    …function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't pass.

    Write the code Medium 2 stages testing assert parsing None
  6. Challenge

    Edge cases

    …first, then the edge cases, an empty list that should give None and lists with negative values, so broken copies of the function can't pass.

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

    Summary function

    Write summarise(readings), which returns the count, min, max and mean of a list of readings as one dict, then make it handle a pass with no data and round the mean, so any program can use the summary.

    Write the code Medium 2 stages functions return dictionaries min