Challenge
Legacy script
A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…
Showing 21–30 of 36
Challenge
A 70-line engine report repeats the same twelve lines for each engine. Restructure it into parse_feed() and summary_line() with the output unchanged to the character, then add assert tests that would…
Challenge
…pattern comes up so often that Python has a whole class for it. Swap it in, then use the one thing a plain dict can't do for you: sort by count. Counter() Import Counter from collections , start with…
Challenge
The logistics team typed the manifest for the next supply flight by hand, and the loading crew won't touch a crate until every line checks out. Last time, a typo in a mass sent a 61 kg battery pack to…
Challenge
…read it with csv.DictReader, using the header row for the field names, then find the hottest temperature reading, comparing the values as numbers.
Challenge
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.
Challenge
…let one try cover both the unpacking and the conversion. For each line it skips, print the line and the error's message: 09:30:05 ENG-2: 412.5 C 09:30:05 TANK-1: 78.3 % Skipped…
Challenge
Move a 3D distance calculation that is copied for three waypoints into distance_km(a, b), keeping the output exactly the same, then put the waypoints in a dict and find the nearest one with the same…
Challenge
…as parse_pressure(None) still raises its TypeError . The loop prints: 101.2 None 100.8
Challenge
…burn_kg) , which returns the fuel left, and use it in a loop over the planned burns, without global . Print: Burn of 180.0 kg, 1020.0 kg left Burn of 45.5 kg, 974.5 kg left Burn of 310.0 kg, 664.5 kg…
Challenge
…from basic operator training to the commander's approval for opening the outer hatch, and the airlock's control panel checks them before it does anything. Check one action for one crew member, then…