Challenge
Sensible defaults
Give send_command(cmd, retries=3, timeout=5.0) default values so callers only pass what differs, call it three different ways, then add a new priority parameter without breaking any existing call.
Showing 1–10 of 38
Challenge
Give send_command(cmd, retries=3, timeout=5.0) default values so callers only pass what differs, call it three different ways, then add a new priority parameter without breaking any existing call.
Challenge
Build a user's settings by copying the defaults and laying their own values on top with update(), so any setting they haven't changed falls back, then warn about unknown keys instead of saving them.
Challenge
…log=[]) remembers samples from earlier calls, because the default list is created once and shared. Predict it, prove the calls share one list, fix it with None as the default, then write a function…
Challenge
…same, then add a new docking rule as one more guard with a default parameter.
Challenge
…it, check the keys with in, fix it with get() and a default, then print a list of launches with defaults for any missing field.
Challenge
…the fixed add_sample() that would have caught the shared default list, then add checks that a log passed in is still the one that gets the sample, so a "fix" that breaks that can't pass either.
Challenge
…stay exactly the same: [T+00:12:05] INFO Engines nominal Define the function at the top: def format_log(t, level, msg): , with return f"..." inside, using its own parameter names. Then…
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
…, so the string has to come right after the def line, before the return . Type hints Add type hints: each parameter is a float , and so is the return value. Keep the default reserve and the docstring…
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…