I would be tempted to go a step further. I think the jobs of iterating over the range and logging the result are separate concerns. I would start by extracting the range iteration. Then I would consider handling the logging elsewhere so that the function returns a string.
That's not to detract from your work though. You've certainly solved the difficult part.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Well done on solving this problem.
I would be tempted to go a step further. I think the jobs of iterating over the range and logging the result are separate concerns. I would start by extracting the range iteration. Then I would consider handling the logging elsewhere so that the function returns a string.
That's not to detract from your work though. You've certainly solved the difficult part.