question 399 Software Architecture · hard
An entry point over the ratings modules
ratings.py (read-only) holds the pure core: parse_ratings(text) and averages(rows). Write the entry point main(argv): argv is [input_csv, output_json] with an optional --min N after them; read the CSV, compute the averages, keep products whose average is at least N (default 0), write them as a JSON object to the output file and return 0. A missing input file prints error: <path> not found and returns 1; wrong arguments return 2.
Function
main(argv) → exit codeargv
[in_csv, out_json] or [in_csv, out_json, "--min", "4"]OutputJSON object
{product_id: average} of the kept productsCodes0 success; 1 input missing (with the message printed); 2 wrong arguments