Results for “functions”

Showing 11–20 of 86

  1. Challenge

    Summary function

    …the ones where the sensor sent nothing. Write one function that returns the whole summary, then make it safe for an empty pass. Four numbers in one dict Write summarise(readings) , which returns a…

    Write the code Medium 2 stages functions return dictionaries min
  2. Challenge

    Read the traceback

    …Read it from the bottom up to find the error, the function and the line, fix the bug there, then follow a longer traceback through four calls to a second bug.

    Fix the code Easy 2 stages errors traceback KeyError TypeError
  3. Challenge

    Extra log fields

    Extend format_log() from "Log formatter function" with **fields, so any extra keyword arguments are added to the line as key=value pairs, then pass whole dicts of fields into it with ** at the call.

    Write the code Medium 2 stages functions **kwargs keyword arguments dictionaries
  4. Challenge

    Test the alert levels

    The engine alert check from "Alert level" is now a function, alert_level() , and other programs depend on it. Before anyone changes it again, it needs tests: small checks that run in a second and…

    Write the code Medium 2 stages testing assert functions boundaries
  5. Challenge

    Sort by a field

    Sort launches by date with sorted() and a small function that returns each launch's date, then sort the cargo manifest heaviest first with a key function and reverse=True.

    Write the code Easy 2 stages functions sorted key reverse
  6. Challenge

    Prints instead of returns

    …caller gets None. Predict the last line, find out what the function gives back, fix it with return, then write a conversion function that returns.

    Fix the code Easy 3 stages functions return print None