Results for “python def”

Showing 31–40 of 71

  1. Challenge

    Flight software review

    A 40-line pre-burn check has five bugs: a syntax error, a type error, a wrong key, an index out of range and a reversed decision. Read each error to fix the four that crash, then find the one that…

    Fix the code Hard 2 stages project debugging SyntaxError TypeError
  2. Challenge

    Test the pipeline

    The telemetry pipeline is now split into parse_row() and check_limits(). Write assert tests for both, good rows, rejected rows and readings right at a limit, so that each of three planted bugs makes…

    Write the code Hard 2 stages project testing assert try
  3. Challenge

    Statistics module

    Refactor the temperature summary: delete the hand-written mean() and median() and use statistics.mean() and statistics.median() instead, then add the standard deviation and handle passes with too few…

    Fix the code Easy 2 stages statistics mean median stdev
  4. Challenge

    Shadowed fuel

    refuel() assigns to fuel_kg inside the function, creating a local variable and leaving the global fuel unchanged. Predict the last line, compare both values, fix it by returning the total, then write…

    Fix the code Medium 3 stages functions scope local variables global variables
  5. Challenge

    Changed the caller's list

    add_reading() appends to the list it receives, so the caller's stored readings change too. Predict the first line, prove both names share one list, fix it by returning a new list, then write a filter…

    Fix the code Medium 3 stages functions lists mutation return
  6. 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
  7. 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
  8. Challenge

    Alert deduplicator

    The monitoring system raises the same alert over and over. Group repeats of an alert that come within 60 seconds of the first into one line with a count, in the order they first appeared, then add the…

    Write the code Hard 2 stages project dictionaries tuples as keys grouping