Goal
Create a tiny Python module at /tmp/summary_bug_demo.py that demonstrates a small off-by-one bug when constructing a summary from a sequence. Implement two functions:
build_summary(items): intentionally omits the last item by iterating with range(len(items) - 1).
build_summary_fixed(items): includes all items (iterate with range(len(items))).
Additionally, add a small demo script that shows the difference when running the module.
What to submit
/tmp/summary_bug_demo.py containing both functions and a short demonstration that prints the buggy vs fixed results when executed.
What to run to verify
python /tmp/summary_bug_demo.py
You should see that the buggy version omits the last element, while the fixed version includes it.
Deliverables
The Python module at /tmp/summary_bug_demo.py with:
build_summary(items)
build_summary_fixed(items)
show_demo() that prints both results
a guard to execute show_demo() when run as a script
Notes
Keep the implementation simple and self-contained; no external dependencies.
Use a small sample list inside show_demo() to illustrate the difference (e.g., ["alpha", "beta", "gamma", "delta"]).