Challenge
JSON out
…then keep the station's Polish letters readable and sort the keys so the files compare easily.
Showing 11–20 of 27
Challenge
…then keep the station's Polish letters readable and sort the keys so the files compare easily.
Article Mini projects
…event_string = json.dumps(event_copy, sort_keys=True) expected_hmac = self._compute_hmac(event_string) if expected_hmac != stored_hmac: raise ValueError(f"HMAC verification failed at event {i}")…
Challenge
…in, then use the one thing a plain dict can't do for you: sort by count. Counter() Import Counter from collections , start with counts = Counter() , and replace the get() line with counts[level] += 1…
Challenge
…permission in needed . If not, print what is missing, sorted: Kowalska can't depressurise the airlock: missing eva_certified needed <= granted is True when every item of needed is in granted . needed…
Quiz
Free Python quiz for beginners: 20 multiple-choice questions on print(), strings, lists, dictionaries, loops and functions, with instant answers.
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
Turn the launch-day mission log into answers: parse each line into a dict, count the entries per level and per hour, find the first ERROR, then rank the subsystems by how many warnings they raised.
Example
Looping through keys, values or key-value pairs of a dictionary.
Challenge
Load the downlink module's JSON settings over a copy of the defaults, check each value's type and range and report every problem in one go, then wrap it all in a load_config() that never crashes, even…
Challenge
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…