My issue
I am getting error at reading test cases, error is EOF(end of file).How can I solve that?(I have tried using try and except but now my program is running with no inputs)
My code
# cook your dish here
try:
t=int(input())
for i in range(0,t):
n=int(input())
lt=list(map(int,input().split()))
l=len(lt)
f=0
if(l%2==0):
print('no')
else:
for j in range(0,l):
if(j<(n-1)/2):
if(lt[j+1]-lt[j]==1):
f=1
else:
f=0
break
elif(j>(n-1)/2):
if(lt[j]-lt[j+1]==1 and j+1<l):
f=1
else:
f=0
break
else:
if(lt[j]-lt[j+1]==1 and lt[j]-lt[j-1]==1):
f=1
else:
f=0
break
if(f==0):
print('no')
else:
print('yes')
except:
pass
Problem Link: Temple Land Practice Coding Problem - CodeChef