Challenge
Undo and history
Extend the working cargo console: record every change to the hold in a history list and show it with a history command, then add undo, which takes the last change off the history and reverses it.
Showing 31–37 of 37
Challenge
Extend the working cargo console: record every change to the hold in a history list and show it with a history command, then add undo, which takes the last change off the history and reverses it.
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 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…
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
…new_record(sensor, value, flags=None) , which returns a dict with a fresh flags list whenever none is given. The program flags the first record, and the second must stay clean: {'sensor': 'ENG-2'…
Challenge
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…
Challenge
…right after the check that found it, count the kinds in a dict called by_kind , and print them sorted after the total: Glitches in 100 readings: 5 DROPOUT: 3 SPIKE: 2 Call random.choice() only for…