# RAINBOWA python code wrong output

here is my python code:

## code

q=“1234567”

k=[]

#function to omit test cases like 2 1 3 4 5 6 7 6 5 4 3 1 2
def is_increasing(n):

``````for i in range(int(len(n)/2)):

if n[i]>n[i+1]:

return False

return True
``````

#function to check given array a rainbow array
def is_rainbow(n):

``````for i in range(len(n)):

if n[i]==n[len(n)-i-1] and str(n[i]) in q and is_increasing(n):

continue

else:

return False

return True
``````

x=int(input())

for i in range(x):

``````s1=int(input())

s=list(map(int,input().split()))

if (is_rainbow(s)):

k.append(1)

else:

k.append(0)
``````

for l in k:

``````if l==1:

print("yes")

else:

print("no")
``````

can you please tell me whats wrong in my code.

Where are you calling the “is increasing” function? Also, what if your array is like

``````1 2 3 4 5 6 7 8 7 6 5 4 3 2 1
``````

Above is not a rainbow array as it has an element more than 7, i.e. 8.

Yep, @vijju123 is right.

Here is my solution in python !

what i essentially did was checked for palindrome and increment the checking factor by one starting with zero and also note the middle element has to be 7 and rest all cases are false