Program in Python to check whether given Number or String is Palindrome or Not?
- The Tech Platform

- Dec 15, 2021
- 1 min read
Updated: Dec 16, 2021
Program to check whether given String is palindrome or not?
Code:
string=input(("Enter a letter:"))
if(string==string[::-1]):
print("The letter is a palindrome")
else:
print("The letter is not a palindrome") Output:


Program to check whether given Integer is Palindrome or not?
Code:
n=int(input("Enter number:"))
temp=n
rev=0
while(n>0):
dig=n%10
rev=rev*10+dig
n=n//10
if(temp==rev):
print("The number is a palindrome!")
else:
print("The number isn't a palindrome!") Output:


Read More:
The Tech Platform




I've been engrossed in Steal a Brainrot lately, exploring its intricate puzzles and captivating storyline. The way Steal a Brainrot challenges my problem-solving skills is truly exhilarating. Have you encountered the secret level in Steal a Brainrot yet? It's mind-boggling!