seriously? I explained two times in this topic why it fails for x=9, plus a more extensive explanation i linked to:
And so far, you have given no acknowledge you read it. Did you read it? Please show me your thought process so i can fill in any gaps, i can keep writing general explanations in slightly different wording, but i don't think that gets us anywhere
I know you are learning (like me) and I know how difficult it is to break away from the thought process of solving the problem in the way that you currently are, but I recommend coming at the problem in a different way. For example, you don't need to use a for loop with range() to solve this problem.
I just spent like 2 hours trying to solve the problem. It was frustrating sometimes but I managed to solve it with a while loop. The tip I can give that might save you some of my frustration is to check your indentations and make sure your returns are making sense in your code.
If you want some more tips or if you want to see my answer you can send me a reply!