I cannot really think of how you would have even implemented that without seeing what code you wrote, and for various reasons it probably is not a good idea to include that code here, not the least of which being that I have seen far too many instances already were even incorrect code is widely being copied and attempted to be placed in as an answer.
You could always try asking the question on one of the various Q&A forum outside of this course. Still, if you choose to do this it would be appreciated if you changed the data structure sufficiently so it did not simply look like a “Question and Answer key” effectively enabling others to look up and rote copy from that source in order to pass this ticket.
Side Note: I have always found it worthwhile to do post mortem responses on course material with better explanations of why certain answered points apply, but of course delievered after the assesment for tasks ( or indeed final exam ) are complete.
That will not be happening here as long as the decision is maintained that topics on the discussion forum are left open in between class iterations. This is currently the decision of how this forum is implemented.
It’s a real shame as open discussion after the fact is a good thing in order to help people understand or debate the WHY? of how answers are obtained. The consequences of NOT removing posts as the class for a course changes over is naturally that simply leaving “All the Answers” available for rote copy is not really acceptable, and clearly defeats the purpose of learning anything.
Yet as noted, this comes at the expense of actually educating the current class. Which is a real shame.