We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
You are doing TL no favours by providing a complete solution; in fact it will harm his learning because he doesn’t have to understand the problem. Don’t be annoyed, but I have altered the solution.
By the way: the original solution would not have worked because there was no way to record or display the result.
posted 3 years ago
Sorry, I was mistaken about displaying the result, because I missed the print statements inside the loop.