This might help, but
first read and understand the given example thoroughly before you try to solve it… half of the answer is provided in the given example itself.
Pro tip
Structure your code in a clean pattern/block , no need to use extra spaces and new lines …Good luck !
It is great that you solved the challenge, but instead of posting your working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
I understand your concern but hints are given on every challenge and this was just a simple understanding issue…the members who post there queries are already frustrated and sometimes they want to quit too , sometimes it is better to give them a solution with an advice for the future problems.