Challenge
Line to record
…as a dict with time, sensor, value and unit in a list of records, then let other code pick out one sensor's readings by key.
Showing 1–10 of 22
Challenge
…as a dict with time, sensor, value and unit in a list of records, then let other code pick out one sensor's readings by key.
Challenge
…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 empty list means the record is…
Challenge
Move the feed 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.
Challenge
…them with logging calls at the right levels, so debug records stay hidden until switched on, then give the fuel code its own named logger.
Article Mini projects
…tables: astronauts : To store personal information medical_records : To keep track of medical check-ups Let's write some Python code to set up our database and main class, and then instantiate that…
Challenge
Print one cargo manifest line for every record in a list of dicts, reading each field by key, then add up the masses in the same loop for a total line.
Challenge
Build a dict that maps every cargo ID to its record, so any item is found with one lookup instead of a search through the list, then answer a list of requests, including an ID that isn't on the…
Challenge
…['CABIN 101.2'] Make: A fresh list every time Write 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…
Challenge
…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 pass.
Challenge
record_launch() adds 1 to a global counter and stops with an UnboundLocalError. Predict it, find out why Python treats the name as local, fix it by passing the count in and returning the new one, then…