I appreciate your enthusiasm, but giving someone the code, outright, is not helpful in the long run. For anyone who has coded for a while, the answer may have seemed “simple as that”, but to a beginner, it’s probably not as apparent - there’s a reason @Groot came here for help.
In situations like these, try to impress process over code - not “what is the answer” but “how do I get to the answer?”, because, in the long run, learning how to teach yourself is much more useful than the knowledge itself. And do so in a way that doesn’t make them feel stupid for not knowing something “simple as that”.
I definitely encourage you to keep contributing to this community, and give this thread a read if you haven’t already: