Problem in Python

#l=[]
t=int(input())
for x in range(0,t):
s=input()
#l.append(s)
z=(s[slice(1,len(s))]+s[slice(1)]==s[slice(len(s)-1,len(s))]+s[slice(0,len(s)-1)])
if(z==True):
print(“Yes”)
else:
print(“No”)

what problem there
giving EOF error and runtime error

If you are working on a Code Chef problem, you should explicitly say which one. It’s better to link your code too, so making an attempt (even if it fails) on CodeChef gives an easy way to do that. Without that information, the exact nature of the problems you’re facing are impossible to investigate or solve.

As far as I can tell, this is your code properly laid out (use a line with 3 backticks before and after code):

# l=[]
t=int(input())
for x in range(0,t):
    s=input()
    # l.append(s)
    z=(s[slice(1,len(s))]+s[slice(1)]==s[slice(len(s)-1,len(s))]+s[slice(0,len(s)-1)])
    if (z==True):
        print(“Yes”)
    else:
        print(“No”)

You don’t need to use a slice function to take a slice of an array; that’s what the foo[st:en] syntax achieves. So I think your line to test something translates to:
z = (s[1:len(s)]+s[0:1] == s[len(s)-1:len(s)]+s[0:len(s)-1])
which in turn simplifies to
z = (s[1:]+s[:1] == s[-1:]+s[:-1])
This simpler test form is probably clear & compact enough to go straight into the if without an intermediate z.

In this code

Are you trying to “Run” without Providing “Custom Input".

1 Like

yes and if I provide custom input then it runs and after submission its give wrong answer.

You need to print in capital as written on the Contest Page

For each test case, If there exists a valid string V, print "YES", otherwise print "NO" 
(without the quotes)

Got AC after the modification
AC Solution