[{"data":1,"prerenderedAt":295},["ShallowReactive",2],{"tag-labels":3,"site-header":4,"article-python-capstone-gradebook-en":75},{},{"featuredPost":5,"navigations":29},{"id":6,"title":7,"title_id":8,"slug":9,"excerpt":10,"excerpt_id":11,"has_translation":12,"published_at":13,"reading_time":14,"hidden_from_listing":15,"tags":16,"thumbnail_image":21,"og_image":22,"series":23,"authors":28},110,"When You Pick a Framework Just to Look Different","Ketika Pilih Framework Cuma Biar Kelihatan Beda","ketika-pilih-framework-cuma-biar-kelihatan-beda","The last time you chose a new framework or library, was it because your problem needed that tool, or because it sounded cool and few people around you were using it? That question is uncomfortable. Technology decisions are often made for reasons that never appear in any technical document.","Terakhir kali kamu milih framework atau library baru, itu karena masalahmu butuh alat itu, atau karena alatnya kedengaran keren dan belum banyak yang pakai? Pertanyaan ini nggak enak dijawab. Soalnya keputusan teknologi sering diambil dengan alasan yang nggak pernah ditulis di dokumen teknis mana pun.",true,"2026-10-06T15:25:21.000Z",5,false,[17,18,19,20],"karier","framework","opini","pengalaman",null,"\u002Fog\u002Fketika-pilih-framework-cuma-biar-kelihatan-beda.png",{"id":24,"title":25,"title_id":26,"slug":27},9,"Articles","Artikel","all",[],[30,49,70],{"collection":31,"item":32},"series",{"__typename":31,"title":25,"title_id":26,"slug":27,"children_series":33},[34,38,42,46],{"title":35,"title_id":36,"slug":37},"Artificial Intelligence","Kecerdasan Artifisial","kecerdasan-artifisial",{"title":39,"title_id":40,"slug":41},"Programming Fundamentals","Konsep Dasar Pemrograman","konsep-dasar-pemrograman",{"title":43,"title_id":44,"slug":45},"Algorithms and Data Structures","Algoritma dan Struktur Data","algoritma-struktur-data",{"title":47,"title_id":47,"slug":48},"LLM Systems","llm-systems",{"collection":31,"item":50},{"__typename":31,"title":51,"title_id":51,"slug":52,"children_series":53},"Tutorial","tutorial",[54,58,62,66],{"title":55,"title_id":56,"slug":57},"Learning Python","Belajar Python","belajar-python",{"title":59,"title_id":60,"slug":61},"Learning Go","Belajar Golang","belajar-golang",{"title":63,"title_id":64,"slug":65},"Learning Java","Belajar Java","belajar-java",{"title":67,"title_id":68,"slug":69},"Learning Pascal","Belajar Pascal","belajar-pascal",{"collection":31,"item":71},{"__typename":31,"title":72,"title_id":72,"slug":73,"children_series":74},"Lab","lab",[],{"article":76,"renderedBody":174,"renderedTakeaway":175,"latestArticles":176,"toc":272},{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":89,"series":90,"authors":164,"seoTitle":167,"seoDescription":168,"body_locale":169,"available_locales":170,"body":172,"takeway":173,"prerequisite":21},164,"Python Capstone: Why a Blank CSV Field Cut the Class Average","Python Capstone: Kenapa Satu Kolom CSV Kosong Memotong Rata-rata Kelas","python-capstone-gradebook","A gradebook reads four students and writes a JSON report. The class average says 52.42, because two empty fields became zeros.","Buku nilai membaca empat siswa dan menulis laporan JSON. Rata-rata kelasnya bilang 52.42, karena dua kolom kosong berubah jadi nol.","2026-11-21T01:00:00.000Z",8,[86,87,88],"python","input-output","cli","\u002Fog\u002Fpython-capstone-gradebook.png",{"id":91,"title":55,"title_id":56,"slug":57,"description":92,"description_id":21,"articles":93,"children_series":118,"parent_series":155},10,"Python from zero: the shape of the language, why it reads the way it does, and where it's the right tool.",[94,113],{"id":95,"title":96,"title_id":97,"slug":98,"excerpt":99,"excerpt_id":100,"has_translation":12,"published_at":101,"reading_time":14,"hidden_from_listing":15,"tags":102,"thumbnail_image":21,"og_image":104,"series":105,"authors":106},139,"Python Classes: the History Every Account Shared","Python Class: Riwayat yang Dipakai Bersama Semua Akun","python-class-object","Two accounts, and each history lists the other account's deposits. The list sat in the class body, `append` never writes to the object, so both accounts appended into the same one.","Dua akun, dan riwayat masing-masing memuat setoran akun lain. List-nya duduk di body class, `append` tidak pernah menulis ke objek, jadi kedua akun menambah ke list yang sama.","2026-11-07T01:00:00.000Z",[86,103],"oop","\u002Fog\u002Fpython-class-object.png",{"id":91,"title":55,"title_id":56,"slug":57},[107],{"authors_id":108},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},1,"Daffa Izzuddin","izzudd","Writer",{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":89,"series":114,"authors":115},{"id":91,"title":55,"title_id":56,"slug":57},[116],{"authors_id":117},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},[119,125,131,137,143,149],{"id":120,"title":121,"title_id":122,"slug":123,"description":124,"cover_image":21},16,"Getting Started with Python","Berkenalan dengan Bahasa Python","python-intro","Your first step with Python: meet the language, install Python 3, poke around the interpreter, and get the syntax.",{"id":126,"title":127,"title_id":128,"slug":129,"description":130,"cover_image":21},17,"Variables, Types, and Operations","Variabel, Tipe Data, dan Operasi","python-variabel-tipe-data","Create variables, then meet the types one by one, from numbers and strings to booleans and the list that keeps tripping up beginners.",{"id":132,"title":133,"title_id":134,"slug":135,"description":136,"cover_image":21},18,"Working with Python Scripts","Menggunakan Script Python","python-pemrograman-dengan-script","Leave the interpreter and start writing real .py files, including how to take input and print output.",{"id":138,"title":139,"title_id":140,"slug":141,"description":142,"cover_image":21},19,"Control Structures","Struktur Kontrol","python-struktur-kontrol","Make a program decide things and repeat work: branching, loops, and list comprehension.",{"id":144,"title":145,"title_id":146,"slug":147,"description":148,"cover_image":21},20,"Functional Programming with Python","Pemrograman Fungsional dengan Python","python-pemrograman-fungsional","Wrap your code in functions so you stop writing the same thing twice. Parameters, return values, and default arguments.",{"id":150,"title":151,"title_id":152,"slug":153,"description":154,"cover_image":21},30,"Collections and Strings","Koleksi dan String","python-collections","Dictionaries, sets, tuples, and the string methods that do the boring parts. The types you need once a program stops holding a single value.",{"id":109,"title":51,"title_id":51,"slug":52,"parent_series":21,"children_series":156},[157,158,160,162],{"id":91,"title":55,"title_id":56,"slug":57,"cover_image":21},{"id":159,"title":59,"title_id":60,"slug":61,"cover_image":21},11,{"id":161,"title":63,"title_id":64,"slug":65,"cover_image":21},13,{"id":163,"title":67,"title_id":68,"slug":69,"cover_image":21},14,[165],{"authors_id":166},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},"Python capstone: a blank score isn't a zero","A gradebook reads four students, writes a JSON report, and the class average comes out 52.42. Two empty fields were counted as zeros.","en",[169,171],"id","The script writes `report.json`. Every number has two decimals, and the class average reads 52.42. The program exited with 0 and printed no error. Yet one of the four students never submitted a single score, and that student still has a row with a grade in it.\n\n## The gradebook, in three files\n\nThis is the first program in the ladder that needs several earlier pieces at once. It reads a CSV file, computes each student's average, and writes a JSON report. You need three files in one folder.\n\nThe first is the data file, `scores.csv`. Dodi has no scores at all, and Budi has no final.\n\n```text\nname,quiz,midterm,final\nAndi,78,84,80\nBudi,92,88,\nCitra,65,70,72\nDodi,,,\n```\n\nThe second is the program, `laporan.py`. The [`@dataclass` decorator](https:\u002F\u002Fdocs.python.org\u002F3\u002Flibrary\u002Fdataclasses.html) writes `__init__`, `__repr__` and `__eq__` for `Student`. [`Path.read_text()`](https:\u002F\u002Fdocs.python.org\u002F3\u002Flibrary\u002Fpathlib.html) returns the whole file as one string, and `splitlines()` cuts it into lines.\n\n```python\n# laporan.py\nimport json\nimport sys\nfrom dataclasses import dataclass\nfrom pathlib import Path\n\n\n@dataclass\nclass Student:\n    name: str\n    scores: list[int]\n\n    def average(self) -> float:\n        return round(sum(self.scores) \u002F len(self.scores), 2)\n\n\ndef read_students(path: Path) -> list[Student]:\n    rows = path.read_text().splitlines()[1:]\n    students = []\n    for row in rows:\n        name, quiz, midterm, final = row.split(\",\")\n        scores = [int(quiz or 0), int(midterm or 0), int(final or 0)]\n        students.append(Student(name, scores))\n    return students\n\n\ndef main() -> None:\n    students = read_students(Path(sys.argv[1]))\n    report = {student.name: student.average() for student in students}\n    graded = [value for value in report.values() if value is not None]\n    summary = {\n        \"students\": report,\n        \"class_average\": round(sum(graded) \u002F len(graded), 2),\n    }\n    Path(\"report.json\").write_text(json.dumps(summary, indent=2))\n    print(json.dumps(summary, indent=2))\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\nThe third is the checker, `check_laporan.py`. It writes `scores.csv` if the file is missing, so you can paste both files into an empty folder. It also deletes any old `report.json` before each run.\n\n```python\n# check_laporan.py\nimport json\nimport subprocess\nimport sys\nfrom pathlib import Path\n\nDATA = \"\"\"name,quiz,midterm,final\nAndi,78,84,80\nBudi,92,88,\nCitra,65,70,72\nDodi,,,\n\"\"\"\nEXPECTED = {\"Andi\": 80.67, \"Budi\": 90.0, \"Citra\": 69.0, \"Dodi\": None}\nCLASS_AVERAGE = 79.89\n\n\ndef run_report():\n    if not Path(\"scores.csv\").exists():\n        Path(\"scores.csv\").write_text(DATA)\n    Path(\"report.json\").unlink(missing_ok=True)\n    return subprocess.run(\n        [sys.executable, \"laporan.py\", \"scores.csv\"],\n        text=True,\n        capture_output=True,\n    )\n\n\ndef report(results):\n    for label, passed, detail in results:\n        mark = \"PASS\" if passed else \"FAIL\"\n        note = f\"  \u003C- {detail}\" if detail and not passed else \"\"\n        print(f\"{mark}  {label}{note}\")\n    passed = sum(1 for _, ok, _ in results if ok)\n    print(f\"\\n{passed} of {len(results)} checks passed\")\n\n\ndef main():\n    run = run_report()\n    crashed = run.returncode != 0\n    last_error = run.stderr.strip().splitlines()[-1] if run.stderr.strip() else \"\"\n    results = [(\"the script runs without crashing\", not crashed, last_error)]\n    if crashed:\n        report(results)\n        return 1\n\n    path = Path(\"report.json\")\n    results.append((\"it writes report.json\", path.exists(), \"no report.json in this folder\"))\n    if not path.exists():\n        report(results)\n        return 1\n\n    summary = json.loads(path.read_text())\n    students = summary.get(\"students\", {})\n    results.append(\n        (\"every student in the file has a row\", sorted(students) == sorted(EXPECTED), str(sorted(students)))\n    )\n    for name, expected in EXPECTED.items():\n        got = students.get(name)\n        label = f\"{name} has no average at all\" if expected is None else f\"{name}'s average is {expected}\"\n        results.append((label, got == expected, f\"got {got}\"))\n\n    results.append(\n        (\n            f\"the class average is {CLASS_AVERAGE}\",\n            summary.get(\"class_average\") == CLASS_AVERAGE,\n            f\"got {summary.get('class_average')}\",\n        )\n    )\n    report(results)\n    return 0 if all(ok for _, ok, _ in results) else 1\n\n\nif __name__ == \"__main__\":\n    sys.exit(main())\n```\n\nRun `python3 check_laporan.py`.\n\n## The red run\n\nHere is what the starter prints.\n\n```text\n$ python3 check_laporan.py\nPASS  the script runs without crashing\nPASS  it writes report.json\nPASS  every student in the file has a row\nPASS  Andi's average is 80.67\nFAIL  Budi's average is 90.0  \u003C- got 60.0\nPASS  Citra's average is 69.0\nFAIL  Dodi has no average at all  \u003C- got 0.0\nFAIL  the class average is 79.89  \u003C- got 52.42\n\n5 of 8 checks passed\n```\n\nBudi has two scores, 92 and 88, so his average is (92 + 88) \u002F 2 = 90.0. The program reports 60.0. That is (92 + 88 + 0) \u002F 3, a third value that the file never contained.\n\nDodi submitted nothing, so he should have no average. The program gives him 0.0, which reads like a real grade.\n\nThe class average should be (80.67 + 90.0 + 69.0) \u002F 3 = 79.89. The program computes (80.67 + 60.0 + 69.0 + 0.0) \u002F 4 = 52.42.\n\n## Where the zero came from\n\nThe culprit is `quiz or 0`. When `split(\",\")` meets an empty field, it gives the empty string `\"\"` for that field. The empty string is falsy, and [`x or y` returns `y` when `x` is falsy](https:\u002F\u002Fdocs.python.org\u002F3\u002Freference\u002Fexpressions.html). So `\"\" or 0` is `0`, and `int(0)` is `0`.\n\nAfter that line, every student has exactly three scores. `sum(scores) \u002F len(scores)` always divides by three, and a blank looks the same as a real zero.\n\nLook at the class-average line in `main()`. It filters with `if value is not None`, but that filter can never fire. Nothing in the program ever returns `None`.\n\n## The fix, in two places\n\nThe first change is in `read_students`. `name, *fields = row.split(\",\")` puts the first field in `name` and the rest in a list called `fields`. Then `scores = [int(field) for field in fields if field.strip()]` keeps only the fields that have something in them. `str.strip()` removes whitespace at both ends, so a field of only spaces is dropped too. Calling `int(\"\")` raises `ValueError`, which is why the code filters the field instead of converting it.\n\nThe second change is in `average()`. When the list is empty, it returns `None`, so a student with no scores has no average instead of a zero. The filter in `main()` now has something to skip.\n\nHere is the whole file again.\n\n```python\n# laporan.py\nimport json\nimport sys\nfrom dataclasses import dataclass\nfrom pathlib import Path\n\n\n@dataclass\nclass Student:\n    name: str\n    scores: list[int]\n\n    def average(self) -> float | None:\n        if not self.scores:\n            return None\n        return round(sum(self.scores) \u002F len(self.scores), 2)\n\n\ndef read_students(path: Path) -> list[Student]:\n    rows = path.read_text().splitlines()[1:]\n    students = []\n    for row in rows:\n        name, *fields = row.split(\",\")\n        scores = [int(field) for field in fields if field.strip()]\n        students.append(Student(name, scores))\n    return students\n\n\ndef main() -> None:\n    students = read_students(Path(sys.argv[1]))\n    report = {student.name: student.average() for student in students}\n    graded = [value for value in report.values() if value is not None]\n    summary = {\n        \"students\": report,\n        \"class_average\": round(sum(graded) \u002F len(graded), 2),\n    }\n    Path(\"report.json\").write_text(json.dumps(summary, indent=2))\n    print(json.dumps(summary, indent=2))\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## The green run\n\nRun the checker again.\n\n```text\n$ python3 check_laporan.py\nPASS  the script runs without crashing\nPASS  it writes report.json\nPASS  every student in the file has a row\nPASS  Andi's average is 80.67\nPASS  Budi's average is 90.0\nPASS  Citra's average is 69.0\nPASS  Dodi has no average at all\nPASS  the class average is 79.89\n\n8 of 8 checks passed\n```\n\nHere is the report it wrote. [`json.dumps` writes the Python value `None` as JSON `null`](https:\u002F\u002Fdocs.python.org\u002F3\u002Flibrary\u002Fjson.html), so Dodi's row reflects the missing scores.\n\n```text\n$ cat report.json\n{\n  \"students\": {\n    \"Andi\": 80.67,\n    \"Budi\": 90.0,\n    \"Citra\": 69.0,\n    \"Dodi\": null\n  },\n  \"class_average\": 79.89\n}\n```\n\n## What the capstone actually asks of you\n\nThe program reads a file with `Path.read_text()`. It keeps one `Student` per row in a list, then turns that list into a dict for the report. It writes the report with `json.dumps`, and it takes the filename from `sys.argv`.\n\nThe script skips the `csv` module and pandas, leaves non-numeric text unhandled so `int()` raises `ValueError`, and does not catch a missing file. Outside this checker, it has no test suite.\n\n## Make the checker misfire\n\nFirst, delete `[1:]` from `read_students`. The header row is now read as a student.\n\n```text\n$ python3 check_laporan.py\nFAIL  the script runs without crashing  \u003C- ValueError: invalid literal for int() with base 10: 'quiz'\n\n0 of 1 checks passed\n```\n\nThe word `quiz` is not a number, so `int()` raises. The checker stops at the first failure, so it reports 1 check instead of 8.\n\nSecond, put `[1:]` back and give Dodi one score by changing his row to `Dodi,,,70`.\n\n```text\n$ python3 check_laporan.py\nPASS  the script runs without crashing\nPASS  it writes report.json\nPASS  every student in the file has a row\nPASS  Andi's average is 80.67\nPASS  Budi's average is 90.0\nPASS  Citra's average is 69.0\nFAIL  Dodi has no average at all  \u003C- got 70.0\nFAIL  the class average is 79.89  \u003C- got 77.42\n\n6 of 8 checks passed\n```\n\nDodi now has one score, so 70.0 is his average and 77.42 is the average over four students. The checker still expects the old file and fails on a correct answer because it hardcodes one set of numbers. A missing value is not a zero: average only the scores present in the file.\n","- An empty CSV field arrives as the empty string, so `quiz or 0` turns a missing score into a real zero and the average divides by three values the file never contained.\n- A student with no scores has no average rather than a 0.0, and returning `None` is what lets the class average skip that row.\n- `name, *fields = row.split(\",\")` plus `if field.strip()` keeps only the fields that hold a number, so each average uses only the scores present in the file.\n- The checker writes `scores.csv` when it is missing and fails on a correct answer once the data changes, because it verifies one fixed dataset rather than every valid input.","\u003Cp>The script writes \u003Ccode>report.json\u003C\u002Fcode>. Every number has two decimals, and the class average reads 52.42. The program exited with 0 and printed no error. Yet one of the four students never submitted a single score, and that student still has a row with a grade in it.\u003C\u002Fp>\n\u003Ch2 id=\"the-gradebook-in-three-files\">The gradebook, in three files\u003C\u002Fh2>\n\u003Cp>This is the first program in the ladder that needs several earlier pieces at once. It reads a CSV file, computes each student&#39;s average, and writes a JSON report. You need three files in one folder.\u003C\u002Fp>\n\u003Cp>The first is the data file, \u003Ccode>scores.csv\u003C\u002Fcode>. Dodi has no scores at all, and Budi has no final.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"name%2Cquiz%2Cmidterm%2Cfinal%0AAndi%2C78%2C84%2C80%0ABudi%2C92%2C88%2C%0ACitra%2C65%2C70%2C72%0ADodi%2C%2C%2C\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>name,quiz,midterm,final\nAndi,78,84,80\nBudi,92,88,\nCitra,65,70,72\nDodi,,,\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The second is the program, \u003Ccode>laporan.py\u003C\u002Fcode>. The \u003Ca href=\"https:\u002F\u002Fdocs.python.org\u002F3\u002Flibrary\u002Fdataclasses.html\">\u003Ccode>@dataclass\u003C\u002Fcode> decorator\u003C\u002Fa> writes \u003Ccode>__init__\u003C\u002Fcode>, \u003Ccode>__repr__\u003C\u002Fcode> and \u003Ccode>__eq__\u003C\u002Fcode> for \u003Ccode>Student\u003C\u002Fcode>. \u003Ca href=\"https:\u002F\u002Fdocs.python.org\u002F3\u002Flibrary\u002Fpathlib.html\">\u003Ccode>Path.read_text()\u003C\u002Fcode>\u003C\u002Fa> returns the whole file as one string, and \u003Ccode>splitlines()\u003C\u002Fcode> cuts it into lines.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PYTHON\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%23%20laporan.py%0Aimport%20json%0Aimport%20sys%0Afrom%20dataclasses%20import%20dataclass%0Afrom%20pathlib%20import%20Path%0A%0A%0A%40dataclass%0Aclass%20Student%3A%0A%20%20%20%20name%3A%20str%0A%20%20%20%20scores%3A%20list%5Bint%5D%0A%0A%20%20%20%20def%20average(self)%20-%3E%20float%3A%0A%20%20%20%20%20%20%20%20return%20round(sum(self.scores)%20%2F%20len(self.scores)%2C%202)%0A%0A%0Adef%20read_students(path%3A%20Path)%20-%3E%20list%5BStudent%5D%3A%0A%20%20%20%20rows%20%3D%20path.read_text().splitlines()%5B1%3A%5D%0A%20%20%20%20students%20%3D%20%5B%5D%0A%20%20%20%20for%20row%20in%20rows%3A%0A%20%20%20%20%20%20%20%20name%2C%20quiz%2C%20midterm%2C%20final%20%3D%20row.split(%22%2C%22)%0A%20%20%20%20%20%20%20%20scores%20%3D%20%5Bint(quiz%20or%200)%2C%20int(midterm%20or%200)%2C%20int(final%20or%200)%5D%0A%20%20%20%20%20%20%20%20students.append(Student(name%2C%20scores))%0A%20%20%20%20return%20students%0A%0A%0Adef%20main()%20-%3E%20None%3A%0A%20%20%20%20students%20%3D%20read_students(Path(sys.argv%5B1%5D))%0A%20%20%20%20report%20%3D%20%7Bstudent.name%3A%20student.average()%20for%20student%20in%20students%7D%0A%20%20%20%20graded%20%3D%20%5Bvalue%20for%20value%20in%20report.values()%20if%20value%20is%20not%20None%5D%0A%20%20%20%20summary%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22students%22%3A%20report%2C%0A%20%20%20%20%20%20%20%20%22class_average%22%3A%20round(sum(graded)%20%2F%20len(graded)%2C%202)%2C%0A%20%20%20%20%7D%0A%20%20%20%20Path(%22report.json%22).write_text(json.dumps(summary%2C%20indent%3D2))%0A%20%20%20%20print(json.dumps(summary%2C%20indent%3D2))%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20main()\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"># laporan.py\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> json\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> sys\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> dataclasses \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> dataclass\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> pathlib \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> Path\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">@dataclass\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> Student\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    name: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">str\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    scores: list[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> average\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(self) -> \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">float\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> round\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">sum\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">self\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.scores) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">\u002F\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> len\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">self\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.scores), \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> read_students\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(path: Path) -> list[Student]:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    rows \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> path.read_text().splitlines()[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    students \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> []\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> row \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> rows:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        name, quiz, midterm, final \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> row.split(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        scores \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> [\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(quiz \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">or\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">), \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(midterm \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">or\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">), \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(final \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">or\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        students.append(Student(name, scores))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> students\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() -> \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">None\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    students \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> read_students(Path(sys.argv[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">]))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    report \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {student.name: student.average() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> student \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> students}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    graded \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> [value \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> value \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> report.values() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> value \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">is\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> None\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    summary \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">        \"students\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: report,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">        \"class_average\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">round\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">sum\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(graded) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">\u002F\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> len\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(graded), \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    Path(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"report.json\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">).write_text(json.dumps(summary, \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">indent\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">    print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(json.dumps(summary, \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">indent\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> __name__\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> ==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"__main__\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    main()\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The third is the checker, \u003Ccode>check_laporan.py\u003C\u002Fcode>. It writes \u003Ccode>scores.csv\u003C\u002Fcode> if the file is missing, so you can paste both files into an empty folder. It also deletes any old \u003Ccode>report.json\u003C\u002Fcode> before each run.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PYTHON\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%23%20check_laporan.py%0Aimport%20json%0Aimport%20subprocess%0Aimport%20sys%0Afrom%20pathlib%20import%20Path%0A%0ADATA%20%3D%20%22%22%22name%2Cquiz%2Cmidterm%2Cfinal%0AAndi%2C78%2C84%2C80%0ABudi%2C92%2C88%2C%0ACitra%2C65%2C70%2C72%0ADodi%2C%2C%2C%0A%22%22%22%0AEXPECTED%20%3D%20%7B%22Andi%22%3A%2080.67%2C%20%22Budi%22%3A%2090.0%2C%20%22Citra%22%3A%2069.0%2C%20%22Dodi%22%3A%20None%7D%0ACLASS_AVERAGE%20%3D%2079.89%0A%0A%0Adef%20run_report()%3A%0A%20%20%20%20if%20not%20Path(%22scores.csv%22).exists()%3A%0A%20%20%20%20%20%20%20%20Path(%22scores.csv%22).write_text(DATA)%0A%20%20%20%20Path(%22report.json%22).unlink(missing_ok%3DTrue)%0A%20%20%20%20return%20subprocess.run(%0A%20%20%20%20%20%20%20%20%5Bsys.executable%2C%20%22laporan.py%22%2C%20%22scores.csv%22%5D%2C%0A%20%20%20%20%20%20%20%20text%3DTrue%2C%0A%20%20%20%20%20%20%20%20capture_output%3DTrue%2C%0A%20%20%20%20)%0A%0A%0Adef%20report(results)%3A%0A%20%20%20%20for%20label%2C%20passed%2C%20detail%20in%20results%3A%0A%20%20%20%20%20%20%20%20mark%20%3D%20%22PASS%22%20if%20passed%20else%20%22FAIL%22%0A%20%20%20%20%20%20%20%20note%20%3D%20f%22%20%20%3C-%20%7Bdetail%7D%22%20if%20detail%20and%20not%20passed%20else%20%22%22%0A%20%20%20%20%20%20%20%20print(f%22%7Bmark%7D%20%20%7Blabel%7D%7Bnote%7D%22)%0A%20%20%20%20passed%20%3D%20sum(1%20for%20_%2C%20ok%2C%20_%20in%20results%20if%20ok)%0A%20%20%20%20print(f%22%5Cn%7Bpassed%7D%20of%20%7Blen(results)%7D%20checks%20passed%22)%0A%0A%0Adef%20main()%3A%0A%20%20%20%20run%20%3D%20run_report()%0A%20%20%20%20crashed%20%3D%20run.returncode%20!%3D%200%0A%20%20%20%20last_error%20%3D%20run.stderr.strip().splitlines()%5B-1%5D%20if%20run.stderr.strip()%20else%20%22%22%0A%20%20%20%20results%20%3D%20%5B(%22the%20script%20runs%20without%20crashing%22%2C%20not%20crashed%2C%20last_error)%5D%0A%20%20%20%20if%20crashed%3A%0A%20%20%20%20%20%20%20%20report(results)%0A%20%20%20%20%20%20%20%20return%201%0A%0A%20%20%20%20path%20%3D%20Path(%22report.json%22)%0A%20%20%20%20results.append((%22it%20writes%20report.json%22%2C%20path.exists()%2C%20%22no%20report.json%20in%20this%20folder%22))%0A%20%20%20%20if%20not%20path.exists()%3A%0A%20%20%20%20%20%20%20%20report(results)%0A%20%20%20%20%20%20%20%20return%201%0A%0A%20%20%20%20summary%20%3D%20json.loads(path.read_text())%0A%20%20%20%20students%20%3D%20summary.get(%22students%22%2C%20%7B%7D)%0A%20%20%20%20results.append(%0A%20%20%20%20%20%20%20%20(%22every%20student%20in%20the%20file%20has%20a%20row%22%2C%20sorted(students)%20%3D%3D%20sorted(EXPECTED)%2C%20str(sorted(students)))%0A%20%20%20%20)%0A%20%20%20%20for%20name%2C%20expected%20in%20EXPECTED.items()%3A%0A%20%20%20%20%20%20%20%20got%20%3D%20students.get(name)%0A%20%20%20%20%20%20%20%20label%20%3D%20f%22%7Bname%7D%20has%20no%20average%20at%20all%22%20if%20expected%20is%20None%20else%20f%22%7Bname%7D's%20average%20is%20%7Bexpected%7D%22%0A%20%20%20%20%20%20%20%20results.append((label%2C%20got%20%3D%3D%20expected%2C%20f%22got%20%7Bgot%7D%22))%0A%0A%20%20%20%20results.append(%0A%20%20%20%20%20%20%20%20(%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22the%20class%20average%20is%20%7BCLASS_AVERAGE%7D%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20summary.get(%22class_average%22)%20%3D%3D%20CLASS_AVERAGE%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20f%22got%20%7Bsummary.get('class_average')%7D%22%2C%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20)%0A%20%20%20%20report(results)%0A%20%20%20%20return%200%20if%20all(ok%20for%20_%2C%20ok%2C%20_%20in%20results)%20else%201%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20sys.exit(main())\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"># check_laporan.py\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> json\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> subprocess\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> sys\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> pathlib \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> Path\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">DATA\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\"name,quiz,midterm,final\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">Andi,78,84,80\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">Budi,92,88,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">Citra,65,70,72\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">Dodi,,,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">\"\"\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">EXPECTED\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"Andi\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">80.67\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"Budi\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">90.0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"Citra\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">69.0\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"Dodi\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">None\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">CLASS_AVERAGE\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> =\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 79.89\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> run_report\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">():\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    if\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> Path(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"scores.csv\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">).exists():\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        Path(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"scores.csv\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">).write_text(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">DATA\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    Path(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"report.json\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">).unlink(\u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">missing_ok\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">True\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> subprocess.run(\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        [sys.executable, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"laporan.py\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"scores.csv\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">],\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFAB70\">        text\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">True\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#FFAB70\">        capture_output\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">True\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    )\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> report\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(results):\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> label, passed, detail \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> results:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        mark \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"PASS\"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"FAIL\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        note \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"  &#x3C;- \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">detail\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> detail \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">and\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">        print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">mark\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">  {\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">label\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">note\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    passed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> sum\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> _, ok, _ \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> results \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> ok)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">    print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">\\n{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">passed\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> of \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{len\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(results)\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> checks passed\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">():\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    run \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> run_report()\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    crashed \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> run.returncode \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">!=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    last_error \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> run.stderr.strip().splitlines()[\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">-\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">] \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> run.stderr.strip() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    results \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> [(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"the script runs without crashing\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">not\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> crashed, last_error)]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> crashed:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        report(results)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    path \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> Path(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"report.json\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    results.append((\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"it writes report.json\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, path.exists(), \u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"no report.json in this folder\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    if\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> path.exists():\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        report(results)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    summary \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> json.loads(path.read_text())\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    students \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> summary.get(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"students\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, {})\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    results.append(\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        (\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"every student in the file has a row\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">, \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">sorted\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(students) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> sorted\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">EXPECTED\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">), \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">str\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">sorted\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(students)))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    )\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> name, expected \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> EXPECTED\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.items():\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        got \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> students.get(name)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        label \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">name\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> has no average at all\"\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> expected \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">is\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> None\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> else\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">name\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'s average is \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">expected\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        results.append((label, got \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> expected, \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"got \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">got\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    results.append(\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        (\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">            f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"the class average is \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{CLASS_AVERAGE}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">            summary.get(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"class_average\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">==\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> CLASS_AVERAGE\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">            f\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"got \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">{\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">summary.get(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">'class_average'\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">}\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        )\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    )\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    report(results)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 0\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> if\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> all\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(ok \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> _, ok, _ \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> results) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">else\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> 1\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> __name__\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> ==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"__main__\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    sys.exit(main())\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Run \u003Ccode>python3 check_laporan.py\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2 id=\"the-red-run\">The red run\u003C\u002Fh2>\n\u003Cp>Here is what the starter prints.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20python3%20check_laporan.py%0APASS%20%20the%20script%20runs%20without%20crashing%0APASS%20%20it%20writes%20report.json%0APASS%20%20every%20student%20in%20the%20file%20has%20a%20row%0APASS%20%20Andi's%20average%20is%2080.67%0AFAIL%20%20Budi's%20average%20is%2090.0%20%20%3C-%20got%2060.0%0APASS%20%20Citra's%20average%20is%2069.0%0AFAIL%20%20Dodi%20has%20no%20average%20at%20all%20%20%3C-%20got%200.0%0AFAIL%20%20the%20class%20average%20is%2079.89%20%20%3C-%20got%2052.42%0A%0A5%20of%208%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>$ python3 check_laporan.py\nPASS  the script runs without crashing\nPASS  it writes report.json\nPASS  every student in the file has a row\nPASS  Andi's average is 80.67\nFAIL  Budi's average is 90.0  &lt;- got 60.0\nPASS  Citra's average is 69.0\nFAIL  Dodi has no average at all  &lt;- got 0.0\nFAIL  the class average is 79.89  &lt;- got 52.42\n\n5 of 8 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Budi has two scores, 92 and 88, so his average is (92 + 88) \u002F 2 = 90.0. The program reports 60.0. That is (92 + 88 + 0) \u002F 3, a third value that the file never contained.\u003C\u002Fp>\n\u003Cp>Dodi submitted nothing, so he should have no average. The program gives him 0.0, which reads like a real grade.\u003C\u002Fp>\n\u003Cp>The class average should be (80.67 + 90.0 + 69.0) \u002F 3 = 79.89. The program computes (80.67 + 60.0 + 69.0 + 0.0) \u002F 4 = 52.42.\u003C\u002Fp>\n\u003Ch2 id=\"where-the-zero-came-from\">Where the zero came from\u003C\u002Fh2>\n\u003Cp>The culprit is \u003Ccode>quiz or 0\u003C\u002Fcode>. When \u003Ccode>split(&quot;,&quot;)\u003C\u002Fcode> meets an empty field, it gives the empty string \u003Ccode>&quot;&quot;\u003C\u002Fcode> for that field. The empty string is falsy, and \u003Ca href=\"https:\u002F\u002Fdocs.python.org\u002F3\u002Freference\u002Fexpressions.html\">\u003Ccode>x or y\u003C\u002Fcode> returns \u003Ccode>y\u003C\u002Fcode> when \u003Ccode>x\u003C\u002Fcode> is falsy\u003C\u002Fa>. So \u003Ccode>&quot;&quot; or 0\u003C\u002Fcode> is \u003Ccode>0\u003C\u002Fcode>, and \u003Ccode>int(0)\u003C\u002Fcode> is \u003Ccode>0\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>After that line, every student has exactly three scores. \u003Ccode>sum(scores) \u002F len(scores)\u003C\u002Fcode> always divides by three, and a blank looks the same as a real zero.\u003C\u002Fp>\n\u003Cp>Look at the class-average line in \u003Ccode>main()\u003C\u002Fcode>. It filters with \u003Ccode>if value is not None\u003C\u002Fcode>, but that filter can never fire. Nothing in the program ever returns \u003Ccode>None\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2 id=\"the-fix-in-two-places\">The fix, in two places\u003C\u002Fh2>\n\u003Cp>The first change is in \u003Ccode>read_students\u003C\u002Fcode>. \u003Ccode>name, *fields = row.split(&quot;,&quot;)\u003C\u002Fcode> puts the first field in \u003Ccode>name\u003C\u002Fcode> and the rest in a list called \u003Ccode>fields\u003C\u002Fcode>. Then \u003Ccode>scores = [int(field) for field in fields if field.strip()]\u003C\u002Fcode> keeps only the fields that have something in them. \u003Ccode>str.strip()\u003C\u002Fcode> removes whitespace at both ends, so a field of only spaces is dropped too. Calling \u003Ccode>int(&quot;&quot;)\u003C\u002Fcode> raises \u003Ccode>ValueError\u003C\u002Fcode>, which is why the code filters the field instead of converting it.\u003C\u002Fp>\n\u003Cp>The second change is in \u003Ccode>average()\u003C\u002Fcode>. When the list is empty, it returns \u003Ccode>None\u003C\u002Fcode>, so a student with no scores has no average instead of a zero. The filter in \u003Ccode>main()\u003C\u002Fcode> now has something to skip.\u003C\u002Fp>\n\u003Cp>Here is the whole file again.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">PYTHON\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%23%20laporan.py%0Aimport%20json%0Aimport%20sys%0Afrom%20dataclasses%20import%20dataclass%0Afrom%20pathlib%20import%20Path%0A%0A%0A%40dataclass%0Aclass%20Student%3A%0A%20%20%20%20name%3A%20str%0A%20%20%20%20scores%3A%20list%5Bint%5D%0A%0A%20%20%20%20def%20average(self)%20-%3E%20float%20%7C%20None%3A%0A%20%20%20%20%20%20%20%20if%20not%20self.scores%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20None%0A%20%20%20%20%20%20%20%20return%20round(sum(self.scores)%20%2F%20len(self.scores)%2C%202)%0A%0A%0Adef%20read_students(path%3A%20Path)%20-%3E%20list%5BStudent%5D%3A%0A%20%20%20%20rows%20%3D%20path.read_text().splitlines()%5B1%3A%5D%0A%20%20%20%20students%20%3D%20%5B%5D%0A%20%20%20%20for%20row%20in%20rows%3A%0A%20%20%20%20%20%20%20%20name%2C%20*fields%20%3D%20row.split(%22%2C%22)%0A%20%20%20%20%20%20%20%20scores%20%3D%20%5Bint(field)%20for%20field%20in%20fields%20if%20field.strip()%5D%0A%20%20%20%20%20%20%20%20students.append(Student(name%2C%20scores))%0A%20%20%20%20return%20students%0A%0A%0Adef%20main()%20-%3E%20None%3A%0A%20%20%20%20students%20%3D%20read_students(Path(sys.argv%5B1%5D))%0A%20%20%20%20report%20%3D%20%7Bstudent.name%3A%20student.average()%20for%20student%20in%20students%7D%0A%20%20%20%20graded%20%3D%20%5Bvalue%20for%20value%20in%20report.values()%20if%20value%20is%20not%20None%5D%0A%20%20%20%20summary%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%22students%22%3A%20report%2C%0A%20%20%20%20%20%20%20%20%22class_average%22%3A%20round(sum(graded)%20%2F%20len(graded)%2C%202)%2C%0A%20%20%20%20%7D%0A%20%20%20%20Path(%22report.json%22).write_text(json.dumps(summary%2C%20indent%3D2))%0A%20%20%20%20print(json.dumps(summary%2C%20indent%3D2))%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20main()\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\" tabindex=\"0\">\u003Ccode>\u003Cspan class=\"line\">\u003Cspan style=\"color:#6A737D\"># laporan.py\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> json\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> sys\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> dataclasses \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> dataclass\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">from\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> pathlib \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">import\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> Path\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#B392F0\">@dataclass\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">class\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> Student\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    name: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">str\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    scores: list[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> average\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(self) -> \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">float\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> |\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> None\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        if\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> self\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.scores:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">            return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> None\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">        return\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> round\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">sum\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">self\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.scores) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">\u002F\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> len\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">self\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">.scores), \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> read_students\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(path: Path) -> list[Student]:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    rows \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> path.read_text().splitlines()[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    students \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> []\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> row \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> rows:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        name, \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">*\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">fields \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> row.split(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\",\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">)\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        scores \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> [\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">int\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(field) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> field \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> fields \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> field.strip()]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">        students.append(Student(name, scores))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">    return\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> students\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">def\u003C\u002Fspan>\u003Cspan style=\"color:#B392F0\"> main\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">() -> \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">None\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    students \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> read_students(Path(sys.argv[\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">1\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">]))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    report \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {student.name: student.average() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> student \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> students}\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    graded \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> [value \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">for\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> value \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">in\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> report.values() \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> value \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">is\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> not\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> None\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">]\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    summary \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\"> {\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">        \"students\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: report,\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#9ECBFF\">        \"class_average\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">: \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">round\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">sum\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(graded) \u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">\u002F\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> len\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(graded), \u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">),\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    }\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    Path(\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\">\"report.json\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">).write_text(json.dumps(summary, \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">indent\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#79B8FF\">    print\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">(json.dumps(summary, \u003C\u002Fspan>\u003Cspan style=\"color:#FFAB70\">indent\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\">=\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\">2\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">))\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#F97583\">if\u003C\u002Fspan>\u003Cspan style=\"color:#79B8FF\"> __name__\u003C\u002Fspan>\u003Cspan style=\"color:#F97583\"> ==\u003C\u002Fspan>\u003Cspan style=\"color:#9ECBFF\"> \"__main__\"\u003C\u002Fspan>\u003Cspan style=\"color:#E1E4E8\">:\u003C\u002Fspan>\u003C\u002Fspan>\n\u003Cspan class=\"line\">\u003Cspan style=\"color:#E1E4E8\">    main()\u003C\u002Fspan>\u003C\u002Fspan>\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Ch2 id=\"the-green-run\">The green run\u003C\u002Fh2>\n\u003Cp>Run the checker again.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20python3%20check_laporan.py%0APASS%20%20the%20script%20runs%20without%20crashing%0APASS%20%20it%20writes%20report.json%0APASS%20%20every%20student%20in%20the%20file%20has%20a%20row%0APASS%20%20Andi's%20average%20is%2080.67%0APASS%20%20Budi's%20average%20is%2090.0%0APASS%20%20Citra's%20average%20is%2069.0%0APASS%20%20Dodi%20has%20no%20average%20at%20all%0APASS%20%20the%20class%20average%20is%2079.89%0A%0A8%20of%208%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>$ python3 check_laporan.py\nPASS  the script runs without crashing\nPASS  it writes report.json\nPASS  every student in the file has a row\nPASS  Andi's average is 80.67\nPASS  Budi's average is 90.0\nPASS  Citra's average is 69.0\nPASS  Dodi has no average at all\nPASS  the class average is 79.89\n\n8 of 8 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Here is the report it wrote. \u003Ca href=\"https:\u002F\u002Fdocs.python.org\u002F3\u002Flibrary\u002Fjson.html\">\u003Ccode>json.dumps\u003C\u002Fcode> writes the Python value \u003Ccode>None\u003C\u002Fcode> as JSON \u003Ccode>null\u003C\u002Fcode>\u003C\u002Fa>, so Dodi&#39;s row reflects the missing scores.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20cat%20report.json%0A%7B%0A%20%20%22students%22%3A%20%7B%0A%20%20%20%20%22Andi%22%3A%2080.67%2C%0A%20%20%20%20%22Budi%22%3A%2090.0%2C%0A%20%20%20%20%22Citra%22%3A%2069.0%2C%0A%20%20%20%20%22Dodi%22%3A%20null%0A%20%20%7D%2C%0A%20%20%22class_average%22%3A%2079.89%0A%7D\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>$ cat report.json\n{\n  \"students\": {\n    \"Andi\": 80.67,\n    \"Budi\": 90.0,\n    \"Citra\": 69.0,\n    \"Dodi\": null\n  },\n  \"class_average\": 79.89\n}\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Ch2 id=\"what-the-capstone-actually-asks-of-you\">What the capstone actually asks of you\u003C\u002Fh2>\n\u003Cp>The program reads a file with \u003Ccode>Path.read_text()\u003C\u002Fcode>. It keeps one \u003Ccode>Student\u003C\u002Fcode> per row in a list, then turns that list into a dict for the report. It writes the report with \u003Ccode>json.dumps\u003C\u002Fcode>, and it takes the filename from \u003Ccode>sys.argv\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>The script skips the \u003Ccode>csv\u003C\u002Fcode> module and pandas, leaves non-numeric text unhandled so \u003Ccode>int()\u003C\u002Fcode> raises \u003Ccode>ValueError\u003C\u002Fcode>, and does not catch a missing file. Outside this checker, it has no test suite.\u003C\u002Fp>\n\u003Ch2 id=\"make-the-checker-misfire\">Make the checker misfire\u003C\u002Fh2>\n\u003Cp>First, delete \u003Ccode>[1:]\u003C\u002Fcode> from \u003Ccode>read_students\u003C\u002Fcode>. The header row is now read as a student.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20python3%20check_laporan.py%0AFAIL%20%20the%20script%20runs%20without%20crashing%20%20%3C-%20ValueError%3A%20invalid%20literal%20for%20int()%20with%20base%2010%3A%20'quiz'%0A%0A0%20of%201%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>$ python3 check_laporan.py\nFAIL  the script runs without crashing  &lt;- ValueError: invalid literal for int() with base 10: 'quiz'\n\n0 of 1 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>The word \u003Ccode>quiz\u003C\u002Fcode> is not a number, so \u003Ccode>int()\u003C\u002Fcode> raises. The checker stops at the first failure, so it reports 1 check instead of 8.\u003C\u002Fp>\n\u003Cp>Second, put \u003Ccode>[1:]\u003C\u002Fcode> back and give Dodi one score by changing his row to \u003Ccode>Dodi,,,70\u003C\u002Fcode>.\u003C\u002Fp>\n\n\u003Cdiv class=\"code-block-wrapper my-6 not-prose rounded-xl border-2 border-black dark:border-gray-600 shadow-neo overflow-hidden bg-[#24292e] text-[#e1e4e8] transition-all\">\n  \u003Cdiv class=\"code-block-header flex items-center justify-between px-4 py-2.5 bg-[#1f2428] border-b-2 border-black dark:border-gray-600 font-mono text-xs font-bold text-gray-300 select-none\">\n    \u003Cdiv class=\"flex items-center gap-2\">\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ff5f56] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#ffbd2e] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"w-3 h-3 rounded-full bg-[#27c93f] border border-black\u002F40 inline-block\">\u003C\u002Fspan>\n      \u003Cspan class=\"ml-2 font-mono font-bold text-xs uppercase tracking-wider text-gray-300\">TEXT\u003C\u002Fspan>\n    \u003C\u002Fdiv>\n    \u003Cbutton type=\"button\" class=\"copy-code-btn flex items-center gap-1.5 px-3 py-1 text-xs font-bold bg-[#2f363d] text-gray-200 border-2 border-black dark:border-gray-500 rounded-lg shadow-neo-sm hover:translate-x-0.5 hover:translate-y-0.5 hover:shadow-none hover:bg-gray-700 transition-all cursor-pointer\" data-code=\"%24%20python3%20check_laporan.py%0APASS%20%20the%20script%20runs%20without%20crashing%0APASS%20%20it%20writes%20report.json%0APASS%20%20every%20student%20in%20the%20file%20has%20a%20row%0APASS%20%20Andi's%20average%20is%2080.67%0APASS%20%20Budi's%20average%20is%2090.0%0APASS%20%20Citra's%20average%20is%2069.0%0AFAIL%20%20Dodi%20has%20no%20average%20at%20all%20%20%3C-%20got%2070.0%0AFAIL%20%20the%20class%20average%20is%2079.89%20%20%3C-%20got%2077.42%0A%0A6%20of%208%20checks%20passed\" title=\"Copy\">\n      \u003Csvg class=\"w-3.5 h-3.5 copy-icon-svg\" fill=\"none\" stroke=\"currentColor\" viewBox=\"0 0 24 24\">\n        \u003Cpath stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z\">\u003C\u002Fpath>\n      \u003C\u002Fsvg>\n      \u003Cspan class=\"copy-text\">Copy\u003C\u002Fspan>\n    \u003C\u002Fbutton>\n  \u003C\u002Fdiv>\n  \u003Cdiv class=\"code-block-content p-4 overflow-x-auto text-sm font-mono leading-relaxed bg-[#24292e]\">\n    \u003Cpre class=\"shiki github-dark\" style=\"background-color:#24292e;color:#e1e4e8\">\u003Ccode>$ python3 check_laporan.py\nPASS  the script runs without crashing\nPASS  it writes report.json\nPASS  every student in the file has a row\nPASS  Andi's average is 80.67\nPASS  Budi's average is 90.0\nPASS  Citra's average is 69.0\nFAIL  Dodi has no average at all  &lt;- got 70.0\nFAIL  the class average is 79.89  &lt;- got 77.42\n\n6 of 8 checks passed\u003C\u002Fcode>\u003C\u002Fpre>\n  \u003C\u002Fdiv>\n\u003C\u002Fdiv>\u003Cp>Dodi now has one score, so 70.0 is his average and 77.42 is the average over four students. The checker still expects the old file and fails on a correct answer because it hardcodes one set of numbers. A missing value is not a zero: average only the scores present in the file.\u003C\u002Fp>\n","\u003Cul>\n\u003Cli>An empty CSV field arrives as the empty string, so \u003Ccode>quiz or 0\u003C\u002Fcode> turns a missing score into a real zero and the average divides by three values the file never contained.\u003C\u002Fli>\n\u003Cli>A student with no scores has no average rather than a 0.0, and returning \u003Ccode>None\u003C\u002Fcode> is what lets the class average skip that row.\u003C\u002Fli>\n\u003Cli>\u003Ccode>name, *fields = row.split(&quot;,&quot;)\u003C\u002Fcode> plus \u003Ccode>if field.strip()\u003C\u002Fcode> keeps only the fields that hold a number, so each average uses only the scores present in the file.\u003C\u002Fli>\n\u003Cli>The checker writes \u003Ccode>scores.csv\u003C\u002Fcode> when it is missing and fails on a correct answer once the data changes, because it verifies one fixed dataset rather than every valid input.\u003C\u002Fli>\n\u003C\u002Ful>\n",[177,182,204,223,236,257],{"id":77,"title":78,"title_id":79,"slug":80,"excerpt":81,"excerpt_id":82,"has_translation":12,"published_at":83,"reading_time":84,"hidden_from_listing":15,"tags":85,"thumbnail_image":21,"og_image":89,"series":178,"authors":179},{"id":91,"title":55,"title_id":56,"slug":57},[180],{"authors_id":181},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},{"id":183,"title":184,"title_id":185,"slug":186,"excerpt":187,"excerpt_id":188,"has_translation":12,"published_at":83,"reading_time":189,"hidden_from_listing":15,"tags":190,"thumbnail_image":21,"og_image":195,"series":196,"authors":201},48,"What a Linked List Actually Is","Tentang Struktur Data LinkedList","tentang-struktur-data-linked-list","A linked list is a linear chain of nodes, each holding data and a pointer to the next node. Here is what that chain looks like, what it costs next to an array, and the same minimal implementation in Java, Python, and JavaScript.","Linked list adalah rantai linear berisi node, dan setiap node menyimpan data plus pointer ke node berikutnya. Ini bentuk rantainya, ongkosnya dibanding array, dan implementasi paling sederhana dalam Java, Python, serta JavaScript.",4,[191,192,193,194],"struktur-data","linked-list","pointer","konsep","\u002Fog\u002Ftentang-struktur-data-linked-list.png",{"id":197,"title":198,"title_id":199,"slug":200},28,"Linear Data Structures","Struktur Data Linear","asd-struktur-linear",[202],{"authors_id":203},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},{"id":205,"title":206,"title_id":207,"slug":208,"excerpt":209,"excerpt_id":210,"has_translation":12,"published_at":211,"reading_time":212,"hidden_from_listing":15,"tags":213,"thumbnail_image":21,"og_image":218,"series":219,"authors":220},163,"Pascal Capstone: Why Every Gradebook Score Came Back Zero","Capstone Pascal: Kenapa Semua Skor Buku Nilai Kembali Nol","pascal-gradebook-capstone","A gradebook reads three students from a file, prints three rows, and every score is 0. The procedure filled a copy of the array, because the parameter was missing `var`. Add the word and the report matches the file; the compiler had already warned about the call that filled nothing.","Sebuah buku nilai membaca tiga siswa dari berkas, mencetak tiga baris, dan setiap skornya 0. Prosedurnya mengisi salinan array, karena parameternya kehilangan `var`. Tambahkan kata itu dan laporannya cocok dengan berkasnya; kompilator sudah memperingatkan soal pemanggilan yang tidak mengisi apa pun.","2026-11-20T01:00:00.000Z",6,[214,215,216,217],"pascal","record","array","prosedur","\u002Fog\u002Fpascal-gradebook-capstone.png",{"id":163,"title":67,"title_id":68,"slug":69},[221],{"authors_id":222},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},{"id":224,"title":225,"title_id":226,"slug":227,"excerpt":228,"excerpt_id":229,"has_translation":12,"published_at":211,"reading_time":212,"hidden_from_listing":15,"tags":230,"thumbnail_image":21,"og_image":231,"series":232,"authors":233},162,"Python File I\u002FO: Why the Second Read Came Back Empty","Python File I\u002FO: Kenapa Pembacaan Kedua Kembali Kosong","python-file-read-write","A notes script saves a line, prints it back, then counts zero. The file on disk is correct: `read()` left the pointer at the end, so the second call returned an empty string. Read once into a variable, or `seek(0)`, and the count matches the file.","Skrip catatan menyimpan satu baris, mencetaknya kembali, lalu menghitung nol. Berkas di disk sudah benar: `read()` meninggalkan pointer di ujung, jadi panggilan kedua mengembalikan string kosong. Baca sekali ke sebuah variabel, atau `seek(0)`, dan hitungannya cocok dengan berkas.",[86,87],"\u002Fog\u002Fpython-file-read-write.png",{"id":132,"title":133,"title_id":134,"slug":135},[234],{"authors_id":235},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},{"id":237,"title":238,"title_id":239,"slug":240,"excerpt":241,"excerpt_id":242,"has_translation":12,"published_at":243,"reading_time":244,"hidden_from_listing":15,"tags":245,"thumbnail_image":21,"og_image":248,"series":249,"authors":254},47,"Why Understanding Algorithms and Data Structures Actually Matters","Pentingnya Memahami Algoritma dan Struktur Data","pentingnya-memahami-algoritma-dan-struktur-data","An algorithm is an ordered list of steps, and that order decides how expensive a problem is. The examples are on the back of an instant noodle packet, in a factorial, and behind ctrl+z.","Sebagai konsep fundamental, algoritma menentukan seberapa mahal sebuah masalah diselesaikan. Contohnya ada di bungkus mie instan, di bilangan faktorial, dan di tombol undo.","2026-11-19T01:00:00.000Z",7,[246,191,194,247],"algoritma","dasar","\u002Fog\u002Fpentingnya-memahami-algoritma-dan-struktur-data.png",{"id":250,"title":251,"title_id":252,"slug":253},27,"About Algorithms and Data Structures","Tentang Algoritma dan Struktur Data","asd-intro",[255],{"authors_id":256},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},{"id":258,"title":259,"title_id":260,"slug":261,"excerpt":262,"excerpt_id":263,"has_translation":12,"published_at":264,"reading_time":244,"hidden_from_listing":15,"tags":265,"thumbnail_image":21,"og_image":267,"series":268,"authors":269},161,"Debugging Free Pascal with -gl and gdb","Men-debug Free Pascal dengan -gl dan gdb","pascal-debugging-fpc-gdb","A run with no prices ends at a hex address and status 217. `-gl` names the line, gdb names the values, and the mean of six positive prices comes out negative because `integer` is 2 bytes.","Jalan tanpa satu harga pun berakhir di alamat hex dan status 217. `-gl` menyebut barisnya, gdb menyebut nilainya, dan rata-rata dari enam harga positif keluar negatif karena `integer` berukuran 2 byte.","2026-11-18T01:00:00.000Z",[214,266],"debugging","\u002Fog\u002Fpascal-debugging-fpc-gdb.png",{"id":163,"title":67,"title_id":68,"slug":69},[270],{"authors_id":271},{"id":109,"name":110,"slug":111,"role":112,"profile_picture":21},[273,277,280,283,286,289,292],{"text":274,"depth":275,"id":276},"The gradebook, in three files",2,"the-gradebook-in-three-files",{"text":278,"depth":275,"id":279},"The red run","the-red-run",{"text":281,"depth":275,"id":282},"Where the zero came from","where-the-zero-came-from",{"text":284,"depth":275,"id":285},"The fix, in two places","the-fix-in-two-places",{"text":287,"depth":275,"id":288},"The green run","the-green-run",{"text":290,"depth":275,"id":291},"What the capstone actually asks of you","what-the-capstone-actually-asks-of-you",{"text":293,"depth":275,"id":294},"Make the checker misfire","make-the-checker-misfire",1795825297561]