x=int(input("Enter a number to check whether it is a palindrome number or not here : "))
 for j in range (m):
 if k==x:
      print("%d is a palindrome nukber"%(x))
      print("%d is not a palindrome number"%(x))

Recommended Answers

All 3 Replies

I would create a function IsPalindrome that checks any string, then pass it a number converted to a string. Why bother with numbers at all? Actually, I did this and the function was four lines including the header.

A palindrome check should be a loop through the first half of the string or 1/2 less checking the mirror byte for a match. To make it a number check, filter for numbers along the way or format number types to a string. For instance, for 9 places check 1 with 9, 2 with 8, 3 with 7, 4 with 6 and who cares about 5! For 1 through length>>1 char n == char length -n +1, with the usual care about the cardinal ordinal numbering of char in a string or array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.