This project is small on purpose. A tool that does one job and can be explained is more valuable for learning than a larger program assembled from pieces you do not understand. You will create a reading-log summary using fictional entries, then show how you know it works within the rules you chose.
13.1 Define a small project
The user is a reader who wants to know total minutes, number of sessions, and average minutes per session. The first version will use a list of fictional numbers. It will not store names, sync across devices, or connect to an account. Those omissions are deliberate: they let us check the core logic before adding interfaces and privacy questions.
Write the rules before the code. Each session length must be a nonnegative, finite number. An empty list has zero sessions and zero total minutes, but no average. Invalid entries produce an error rather than being silently skipped. Decide whether 0 is allowed; here it is, because a started session may record no completed minutes. Decide whether decimals are allowed; here they are, though a later design might ask for whole minutes only.
Your problem statement can be: “Given a list of nonnegative, finite minute values, report count, total, and average. For an empty list, report no average. Reject a list containing an invalid entry.” That is enough for someone else to test your result.
13.2 Build and check the core
Here is a starter program. Read it line by line before running it. It deliberately contains a defect.
from math import isfinite
def summarize(sessions):
total = 0
for minutes in sessions:
if (isinstance(minutes, bool) or not isinstance(minutes, (int, float))
or not isfinite(minutes) or minutes < 0):
return None
total = total + minutes
count = len(sessions)
average = total / count
return {"count": count, "total": total, "average": average}
print(summarize([20, 15, 25]))
For [20, 15, 25], the expected count is 3, total is 60, and average is 20. For [], the loop does nothing, count is 0, and total / count attempts division by zero. The defect is the missing empty-list decision. Fix it before the division:
if count == 0:
return {"count": 0, "total": 0, "average": None}
Place those two lines after count = len(sessions) and before average = total / count, keeping the indentation inside the function. Now predict and, if possible, run four cases: [20, 15, 25], [], [0, 10], and [20, -5]. Expected results are {count: 3, total: 60, average: 20}, {count: 0, total: 0, average: None}, {count: 2, total: 10, average: 5}, and None. The printed Python dictionaries include quoted keys and may show 20.0 and 5.0; those are the same numeric values for this exercise.
If you cannot run Python, trace total, minutes, and count on paper. Record this as evidence that you can explain the program, not as evidence that you independently typed and executed it.
13.3 Explain the whole system
The program above uses data in memory. It has no file save step. When it stops, the list and result disappear unless you copied them somewhere. To keep a reading log, you could add a local file or a database. A file would need a format and a location. A database could coordinate more records or users. Either choice needs a backup plan if the data matters.
If you made it an online service, the browser would send entries over a network to a server. The server would validate them again, check who may access them, and store them. The user would need clear feedback for invalid input and for an unavailable service. An account adds recovery and privacy obligations. Draw this as boxes and arrows, or explain it in sentences. Mark exactly where data leaves the device.
Check. Would adding a “Save” button to the page alone make the program persistent? Answer: No. The button must trigger code that actually writes to durable storage, and the user needs to know where and under whose control that storage sits.
13.4 Review and choose a next step
Show your result to another person, or act as your own reviewer after a break. State the problem, demonstrate one normal and one edge case, and say what the program does not do. If you used AI help, identify which parts it suggested and how you checked them. You should be able to explain every line you keep.
Choose one realistic improvement: read sessions from a local CSV file, show clearer error messages, add dates and totals by month, or make a simple accessible interface. Pick one and state what new tests it would need. Do not claim the program is ready for real users merely because the four examples pass.
Submit or keep these six items: a short problem statement; your program or a careful trace; fictional sample data; expected and actual results for normal, empty, and invalid cases; a system diagram or written data-flow explanation; and one improvement with its tradeoff.
Self-check. Can you explain why an empty list has no average, where data is stored, what validation protects, and which claim your tests support? If one answer is unclear, revisit the relevant module and revise your explanation. That is a normal part of learning, not a failure.
This course has given you a map, not every road. You can now go deeper into programming, data, systems, web development, security, or AI with a clearer idea of what each field builds on.