Palindrome Number: The number which is equal to reverse number know as Palindrome Number. For example Number 12321 is a Palindrome Number, because 12321 is equal to its reverse Number 12321.
Steps for checking Palindrome number:
- Find reverse of the given number.
- Compare that number with the reverse number.
- If number and its reverse is equal then it is a Palindrome Number otherwise not.
We are implementing this program using the concept of classes and objects.
Firstly, we create the Class with "Check" name with 1 attributes (number) and 2 methods, the methods are:
- Constructor Method: This is created using __init__ inbuilt keyword. The constructor method is used to initialize the attributes of the class at the time of object creation.
- Object Method: isPalindrome() is the object method, for creating object method we have to pass at least one parameter i.e. self keyword at the time of function creation. This Object method has no use in this program.
Secondly, we have to create an object of this class using a class name with parenthesis then we have to call its method for our output.
Python code to check palindrome number
Output
need an explanation for this answer? contact us directly to get an explanation for this answer