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.
Showing 21–30 of 79
Challenge
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.
Challenge
Write assert checks for alert_level(): one temperature for each level first, then the values exactly on each threshold and just below them, so a > written instead of >= can't slip through.
Challenge
Write validate_cargo(item), which returns a list of everything wrong with a cargo record: missing fields and a negative mass, then a cargo ID that doesn't match the CG- and four digits format. An…
Challenge
Write convert(), which looks a unit pair up in a table of factors, works the other way round by dividing, and refuses unknown units or missing pairs with a clear ValueError, then extend the table with…
Challenge
Write assert checks for parse_line() from "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…
Challenge
…both commas and dots with replace(), then read pressures written like 1 013,25.
Challenge
…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 them fail.
Challenge
Write a telemetry reading as a CSV row with print() and sep, add a header row, then switch to tabs for pasting into a spreadsheet. Real data formats from print().
Challenge
…, row["value"] and so on. Leave the lines that write the file as they are. The hottest reading While you loop, keep the hottest reading in degrees Celsius, unit C , in hottest , and print it after the…
Challenge
…run the code yet. Read it and decide what it will print. Write your guess in prediction , at the top, between the quotes. Then run it and compare. Any guess passes this stage: the point is to think…