Write a program to see if the input number is a palindrome. If it is a palindrome, find the sum of digits of the number and print it. Else print (“Not a palindrome!”) My CODE:
num = int(input())
temp=num
rev=0
while num>0:
dig=num%10
rev=rev*10+dig
num=num//10
if(temp==rev):
print('It is a palindrome!')
else:
print('Not a palindrome!')
I have checked the condition for palindrome but how to sum the digits here to print only them as final result?