var1 = int(input("enter a number:"))
num = str(var1)[::-1]
if var1 == num:
print("its a palindrome")
else:
print("its not a palindrome")
enter a number:121 ---> expected "its a palindrome"
its not a palindrome
enter a number:123
its not a palindrome
Why doesn't the code work in the first example?
While comparing, convert var1 to string: