Results for “copy”

Showing 1–10 of 27

  1. Challenge

    Copy-pasted blocks

    Replace three copy-pasted tank-status blocks with a list of (name, level) pairs and one loop, keeping the output exactly the same, then add a fourth tank with a single list item and list the low…

    Fix the code Medium 2 stages refactoring for loop tuples lists
  2. Challenge

    Backup that isn't

    …live roster too. Predict it, prove it with is, fix it with copy(), then plan a crew swap on a real copy.

    Fix the code Medium 3 stages lists copy references is
  3. Challenge

    Sorted copy

    …The same list has to be shown both ways. Make a sorted copy for the report and leave the original alone, then make the sort cope with names that start with a small letter. A copy for the report Print…

    Write the code Easy 2 stages lists sorted sort key
  4. Challenge

    Settings with defaults

    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.

    Write the code Medium 2 stages dictionaries copy update defaults
  5. Challenge

    Config loader

    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…

    Write the code Hard 3 stages project json configuration validation
  6. Challenge

    Duplicate events

    Print each capsule event once, keeping the first copy, by checking every ID against a set of IDs already seen, then report which IDs came in more than once.

    Write the code Medium 2 stages sets add in deduplication
  7. Article Mini projects

    Medical dispenser - Don’t trust the user

    …# Reconstruct the message that was signed event_copy = event.copy() stored_hmac = event_copy.pop('hmac') event_string = json.dumps(event_copy, sort_keys=True) expected_hmac =…

  8. Challenge

    Unreachable branch

    …with the value 63. Investigate and modify Investigate. Copy the condition Python checks first into checked_first , as text. Then think about any value at all: could it ever reach the CRITICAL branch…

    Fix the code Easy 3 stages if elif order of conditions debugging
  9. Challenge

    Assignment in a condition

    An oxygen check uses = instead of == and has a line that isn't indented, so Python refuses to run it. Predict what happens, fix both errors one after the other, then write an if/else check yourself.

    Fix the code Easy 3 stages if else == SyntaxError