This is the link to the question :
And this is my answer:
def pal(n):
d=n
num=0
d=n
while d!=0:
r=d%10
d/=10
num=num*10+r
if num==n:
return True
else:
return False
def n_pal(n):
n=n+1
while pal(n)==False:
n=n+1
return n
num=int(raw_input())
nums=[]
for i in range(0,num):
n=raw_input()
nums.append(n)
for i in range(0,num):
print(n_pal(int(nums[i])))
I am compiling it through python 2.5 compiler but I am getting the Time exceed error.
Can anyone help me on this?