My issue
I only want to use if else statements to solve the question , I know that my code is correct but i still get the wrong output, can anyone help me to solve this and let me know if i am wrong
My code
T = int(input())
for ak in range(T):
X = input()
A = X[-1]
if int(A) == 5 or int(A) == 0 :
print("Yes")
elif '5' in X or '0' in X:
if '5' in X:
d = X.replace(X[-1], '5')
if int(d) % 5 == 0:
print("Yes")
else:
print("No")
elif '0' in X:
k = X.replace(X[-1], '0')
if int(k) % 5 == 0:
print("Yes")
else:
print("No")
else:
print("No")
Problem Link: DIGARR Problem - CodeChef
You are not reading the input correctly. Each of the T test cases consists of 2 lines. The first line is the length of the integer that has to be rearranged. The second line of each test case is the integer that has to be rearranged.
I’m Grateful for your explanation but can you elaborate your answer like i still didn’t get that… I would be much obliged if you could drop the code using only if else statement and solving the question. 

As pointed out each test case consists of two lines: the length N of the integer and the integer X itself. Even though N is not really needed you still must read these lines, since otherwise N is read into the variable X. If you are unsure that your code is incorrect then you could add checks for things that you know must be true. E.g., here the length of the variable X must be N. Hence, the part of the code that reads the test cases could look like this:
T = int(input())
for ak in range(T):
N = int(input())
X = input()
# Just making sure that the input was read correctly.
assert len(X) == N
# Add the remainder of the code below.