Read and write a small JSON list of names. path is a string or pathlib.Path. Names are strings.

Prototype: decode_names(text) parses JSON text and returns the result if it is a list containing only strings. Raise ValueError for malformed JSON or the wrong shape. Empty lists are valid.

Final: load_names(path) reads UTF-8 text and applies the same rules. save_names(path, names) writes the provided list as UTF-8 JSON and returns None. Preserve name order and Unicode, and do not mutate the list. An existing file is replaced. Exact whitespace and escaping in the JSON are not specified. Missing files raise FileNotFoundError; wrong-shape or malformed content raises ValueError. The parent directory exists; no directory creation or atomic replacement is required. Example content ["Ada", "李"] loads as the same two names.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.