Results for “end”

Showing 11–20 of 56

  1. Challenge

    JSON out

    At the end of each day, the mission dashboard sends a summary to the archive, and the archive only takes JSON. The summary already exists as a Python dict. Printing it with print(summary) looks close…

    Write the code Easy 2 stages json json.dumps modules import
  2. Challenge

    Roster changes

    …Apply the changes in this order: add the new member at the end, insert the backup at position 1, remove the one who is leaving. Then print the roster and its size: Roster: Okafor, Haddad, Lindqvist…

    Write the code Easy 2 stages lists append insert remove
  3. Challenge

    Extra log fields

    …take any extra keyword arguments and add each one to the end of the line as a space and key=value , in the order they were passed: [T+00:12:05] INFO Engines nominal [T+00:14:47] ERROR Fuel valve 2 not…

    Write the code Medium 2 stages functions **kwargs keyword arguments dictionaries
  4. Challenge

    Shared default list

    …with the morning's sample already in it, and by the end of the week every new log held every sample ever taken. Predict what the program prints, find out where the old samples come from, fix the…

    Fix the code Medium 3 stages functions default values mutable defaults None
  5. Challenge

    Backup that isn't

    …crew , remove Tanaka from the copy and add Moreau at the end. Then print both: Current: Okafor, Lindqvist, Tanaka, Kowalska Planned: Okafor, Lindqvist, Kowalska, Moreau The current roster must not…

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

    Changed the caller's list

    add_reading() appends to the list it receives, so the caller's stored readings change too. Predict the first line, prove both names share one list, fix it by returning a new list, then write a filter…

    Fix the code Medium 3 stages functions lists mutation return
  7. 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…

    Fix the code Hard 2 stages project refactoring functions testing
  8. Challenge

    Redact the access code

    Replace all but the last four characters of an access code with * using len(), slicing and string repetition, then find a code inside a log line and mask it there before the line is saved.

    Write the code Medium 2 stages strings slicing len replace
  9. Challenge

    JSON-looking payload

    …it goes wrong: Python takes the first inner quote as the end of the text. Quotes inside quotes Run the script: Python stops with a SyntaxError , because the double quote before status ends the text…

    Fix the code Medium 2 stages quotes escape sequences f-strings json
  10. Challenge

    Guard clauses

    …reason for a refusal now sits four levels deep, at the far end of an else whose if is off the top of the screen. Flatten the function without changing a single answer, then add the next rule the…

    Fix the code Medium 2 stages functions return guard clauses refactoring