I don't get why this is wrong

So I was solving this problem and I was getting correct outputs for what they were asking but It still marked it wrong as an answer. Here is my code link:


Please search the forums before posting a new thread: this comes up over and over again :slight_smile:

1 Like

Your code is 95% correct, but it doesn’t consider the case when the input is a single digit number as pointed out by @ssjgz. I have added the necessary code to your code to fix the issue. Take a look and analyze it:

T = int(input())
for t in range(T):
    list = [int(x) for x in str(input())]
    #start of section added by me
    if len(list) == 1:
    #end of section added by me

Cheers :slight_smile: