Skip to content
Home » Palindrome Number without using String Functions in Python

Palindrome Number without using String Functions in Python

Learn about Palindrome Number without using String Functions in Python in the below code example. Also, refer to the comments in the code snippet to get a detailed view of what’s actually happening.

Write a Python program to determine whether or not a string is a palindrome. If the reverse of a string is the same as the given string, it is said to be a palindrome. For instance, “madam” is a palindrome, but “sir” is not.

Example : Palindrome Number without using String Functions in Python

The below program explains to you how to use the slicing method to check whether the given number or string is a palindrome or not.

# Palindrome number in python without using string functions

num = input()

# check number is palindrome or not
if(num == num[::-1]):
   print(num,'is a Palindrome')
else:
   print(num,'is not a Palindrome')

Input : radar
Output : radar is a Palindrome

Input : 151
Output : 151 is a Palindrome

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Code : Print 1 to 10 numbers without Loop in Python