{"id":12141,"date":"2022-09-26T14:49:00","date_gmt":"2022-09-26T09:19:00","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/"},"modified":"2024-12-16T09:48:26","modified_gmt":"2024-12-16T04:18:26","slug":"palindrome-in-python","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/","title":{"rendered":"What is Palindrome in Python? Codes, Algorithms, and more"},"content":{"rendered":"\n<p>A palindrome in Python is any sequence of elements like a word, phrase, or even a number that can be read the same way from both directions. When you reverse its characters, they are in the same sequence as the original word. For example, if you read madam from either left or right, it will be madam only. Palindromes can be numeric as well.&nbsp;<\/p>\n\n\n\n<p>These patterns, known as palindromes, are not just interesting, but also practical to solve using programming. Whether you read them from the first character or from the end, they remain unchanged. In this blog, we'll explore the thought process, step by step, and come up with various solutions to determine if a given input is a palindrome.<\/p>\n\n\n\n<p>Palindromes are of broadly 3 types, namely palindrome numbers, palindrome strings, palindrome phrases, collections of words, and special characters.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Academy Pro<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-python-programming\" class=\"courses-cta-title-link\">Python Programming Course<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">In this course, you will learn the fundamentals of Python: from basic syntax to mastering data structures, loops, and functions. You will also explore OOP concepts and objects to build robust programs.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>11.5 Hrs<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>51 Coding Exercises<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/master-python-programming\" class=\"courses-cta-button\">\n                Start Free Trial\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-palindrome\"><strong>What is Palindrome? <\/strong><\/h2>\n\n\n\n<p>A palindrome is a word, phrase, number, or another sequence of units that may be read the same way in either direction, generally if used comma-separated.<\/p>\n\n\n\n<p>Happy belated multi-cultural palindrome day! 02\/02\/2020 was a unique day in February. It works whether your preferred date format is MM\/DD\/YYYY or DD\/MM\/YYYY or YYYY\/MM\/DD. <gwmw style=\"display:none;\"><\/gwmw><\/p>\n\n\n<figure class=\"wp-block-image size-large zoomable\" data-full=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-for-blog.png\"><img decoding=\"async\" width=\"612\" height=\"644\" src=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-for-blog.png\" alt=\"Palindrome example\" class=\"wp-image-12238\" srcset=\"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-for-blog.png 612w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-for-blog-285x300.png 285w, https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-for-blog-399x420.png 399w\" sizes=\"(max-width: 612px) 100vw, 612px\" \/><\/figure>\n\n\n\n<p>These patterns are called palindromes. Reading them from the first character or backward doesn\u2019t make any difference. This is an interesting introductory problem to solve with the use of programming. In this blog, we will understand the thought process, go step by step, and come up with various solutions to check whether the string is a palindrome. <\/p>\n\n\n\n<p><mark>A palindrome<\/mark> is a word, phrase, number, <mark>or another sequence<\/mark> of characters that<mark> reads the same backward as forward<\/mark>. <\/p>\n\n\n\n<p>They are classified into 3 types, which are Palindrome numbers, <br>Palindrome strings, Palindrome phrase: A collection of words and special characters.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Palindrome In Python | Python Program To Check Palindrome Numbers | Great Learning\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/4x_NOxEvY-k?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-a-palindrome-number\"><strong>What is a Palindrome Number?<\/strong><\/h2>\n\n\n\n<p>A palindrome number in Python is a collection of numbers that remain the same when read from either direction. These numbers are also said to be symmetrical. When the digits are reversed, they are the same as the original. <\/p>\n\n\n\n<p>For example, 1234321 is a Palindrome. If its digits are reversed, it again becomes 1234321, our original number. 1234232 is not a Palindrome. When reversed, the new number becomes 2324321, which differs from the original.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-a-palindrome-string\"><strong>What is a Palindrome String?<\/strong><\/h2>\n\n\n\n<p>A palindrome string is a collection of alphabets or letters that remains the same when read from either direction. If you write alphabets in reverse order, they are the same combination of alphabets as the original string. <\/p>\n\n\n\n<p>E.g., \u201cradar\u201d is a Palindrome. If its alphabets are reversed, it again becomes \u201cradar,\u201d which was our original string. \u201cnapkin\u201d is not a Palindrome. When reversed, the new string becomes \u201cnikpan\u201d which differs from the original string.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-the-palindrome-phrase\"><strong>What is the Palindrome Phrase?<\/strong><\/h2>\n\n\n\n<p>A palindrome phrase is a collection of words and special characters that remain the same when read from both ends. These phrases are also said to be symmetrical. When you reverse the phrase, it turns out to be the same as the original one. <\/p>\n\n\n\n<p>For example, a1b2c33c2b1a is a Palindrome. If the words are reversed, it again becomes a1b2c33c2b1a, our original phrase. a4b523kg is not a Palindrome. When reversed, the new phrase becomes gk325b4a, which is different from the original phrase.<\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Texas McCombs, UT Austin<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/onlineexeced.mccombs.utexas.edu\/online-ai-machine-learning-course\" class=\"courses-cta-title-link\">Post Graduate Program in AI &amp; Machine Learning: Business Applications<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Master in-demand AI and machine learning skills with this executive-level AI course\u2014designed to transform professionals into strategic tech leaders.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>Duration: 7 months<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>4.72\/5 Rating<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/onlineexeced.mccombs.utexas.edu\/online-ai-machine-learning-course\" class=\"courses-cta-button\">\n                Take your First Step\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"palindrome-examples\"><strong>Palindrome Examples<\/strong><\/h2>\n\n\n\n<p>Below are a few examples of Palindromes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Mom<\/li>\n\n\n\n<li>Madam<\/li>\n\n\n\n<li>a2332a<\/li>\n\n\n\n<li>Rubber<\/li>\n\n\n\n<li>Dad<\/li>\n\n\n\n<li>123454321<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"palindrome-in-python-algorithm\"><strong>Palindrome in Python Algorithm<\/strong><\/h2>\n\n\n\n<h2 class=\"wp-block-heading\" class=\"wp-block-heading\" id=\"algorithm-to-check-for-palindrome-in-python\"><strong>Algorithm to Check for Palindrome in Python&nbsp;<\/strong><\/h2>\n\n\n\n<p>The algorithm for the problem statement, Find if a <strong>string<\/strong> is a Palindrome or not, is as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check if the digits on the first index are the same as the last index; if not the same, return false.<\/li>\n\n\n\n<li>Increment the first index and decrease the last index<\/li>\n\n\n\n<li>Repeat step 2 while first index &lt; last index&nbsp;<\/li>\n\n\n\n<li>If( first index &gt; last index), then return True<\/li>\n<\/ul>\n\n\n\n<p>Now, let us consider an algorithm for the problem statement: Write the algorithm to find whether a <strong>number<\/strong> is a Palindrome number in python.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Copy the input number in another variable to compare them later.<\/li>\n\n\n\n<li>Next, we logically reverse the given number. To do that, follow these steps:\n<ol class=\"wp-block-list\">\n<li>To isolate the last digit of a number, we need to find the modulo (%) of the number with 10, which returns the remainder, which is the last digit.<\/li>\n\n\n\n<li>Append lastDigit to reverse with the formula reverse = (reverse * 10) + lastDigit.<\/li>\n\n\n\n<li>Remove the last digit from the original number by performing number = number \/ 10.<\/li>\n\n\n\n<li>Repeat these steps while (number &gt; 0)<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Now, we compare the reversed number with the original number.<\/li>\n\n\n\n<li>If the numbers are the same, then the number is a palindrome; otherwise, it is not.<\/li>\n<\/ol>\n\n\n\n<p>Now that we have the algorithm, let us convert it into code by following a similar logic.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"palindrome-in-python-code\"><strong>Palindrome in Python Code<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"using-while-loop-number\"> <strong>Using While Loop (number) <\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>number=int(input(\"Enter any number :\"))\n#store a copy of this number\ntemp=number\n#calculate reverse of this number\nreverse_num=0\nwhile(number&gt;0):\n    #extract last digit of this number\n    digit=number%10\n    #append this digit in reveresed number\n    reverse_num=reverse_num*10+digit\n    #floor divide the number leave out the last digit from number\n    number=number\/\/10\n#compare reverse to original number\nif(temp==reverse_num):\n    print(\"The number is palindrome!\")\nelse:\n    print(\"Not a palindrome!\")<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"using-while-loop-strings\"><strong>Using While-loop strings<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def check_palindrome(string):\n    length = len(string)\n    first = 0\n    last = length -1 \n    status = 1\n    while(first&lt;last):\n           if(string&#091;first]==string&#091;last]):\n               first=first+1\n               last=last-1\n           else:\n               status = 0\n               break\n    return int(status)  \nstring = input(\"Enter the string: \")\nprint(\"Method 1\")\nstatus= check_palindrome(string)\nif(status):\n    print(\"It is a palindrome \")\nelse:\n    print(\"Sorry! Try again\")<\/code><\/pre>\n\n\n\n<p><strong><a href=\"https:\/\/www.onlinegdb.com\/online_python_interpreter\" target=\"_blank\" rel=\"noreferrer noopener nofollow\" aria-label=\"TEST THE CODE (opens in a new tab)\">TEST THE CODE<\/a><\/strong><\/p>\n\n\n\n<p><strong><mark>Input - Madam<br>Output - It is a palindrome<\/mark><\/strong><\/p>\n\n\n\n<p>This is a good approach, but <mark>Python enables us to use the reverse function<\/mark>. We know that a word read forwards and backward if the same is a palindrome. Hence, let us generate the forward and backward strings for the same and check if the two strings are the same. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"using-reverse-function\"><strong>Using Reverse Function<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def check_palindrome_1(string):\n    reversed_string = string&#091;::-1]\n    status=1\n    if(string!=reversed_string):\n        status=0\n    return status\n\n\nstring = input(\"Enter the string: \")\nstatus= check_palindrome_1(string)\nif(status):\n    print(\"It is a palindrome \")\nelse:\n    print(\"Sorry! Try again\")<\/code><\/pre>\n\n\n\n<p> <strong><a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/www.onlinegdb.com\/online_python_interpreter\" target=\"_blank\">TEST THE CODE<\/a><\/strong> <\/p>\n\n\n\n<p><mark>Input<\/mark>: Enter the string: malayalam<br>Output<mark>: It is a palindrome<\/mark><\/p>\n\n\n\n<p>This is a good approach, but&nbsp;<mark>Python enables us to use the reverse function<\/mark>. We know that a word reads forwards and backward if the same is a palindrome. Hence, let us generate the forward and backward strings for the same and check if the two strings are the same.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"using-reverse-function\"><strong>Using Reverse Function<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>def check_palindrome_1(string):\n    reversed_string = string&#091;::-1]\n    status=1\n    if(string!=reversed_string):\n        status=0\n    return status\n\n\nstring = input(\"Enter the string: \")\nstatus= check_palindrome_1(string)\nif(status):\n    print(\"It is a palindrome \")\nelse:\n    print(\"Sorry! Try again\")<\/code><\/pre>\n\n\n\n<p><strong><a rel=\"noreferrer noopener\" href=\"https:\/\/www.onlinegdb.com\/online_python_interpreter\" target=\"_blank\">TEST THE CODE<\/a><\/strong><\/p>\n\n\n\n<p><mark>Input: Enter the string: malayalam<br>Output: It is a palindrome<\/mark><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"palindrome-program-in-python\"><strong>Palindrome Program in Python<\/strong><\/h2>\n\n\n\n<p>In this article, we will see different ways of implementing the palindrome program in Python<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"palindrome-string\"><strong>Palindrome String<\/strong><\/h3>\n\n\n\n<p><strong>Method 1:<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Finding the reverse of a string<\/li>\n\n\n\n<li>Checking if the reverse and original are the same or not<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>def isPalindrome(s):\n\treturn s == s&#091;::-1]\n\n# Driver code\ns = \"kayak\"\nans = isPalindrome(s)\n\nif ans:\n\tprint(\"Yes\")\n\nelse:\n\tprint(\"No\")<\/code><\/pre>\n\n\n\n<p><strong>Steps:&nbsp;<\/strong>&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>We create a function ispalindrome<\/li>\n\n\n\n<li>Return a variable by slicing the parameter in a reverse way<\/li>\n\n\n\n<li>In our driver code, we wrote a string&nbsp;<\/li>\n\n\n\n<li>Finally, in our if-else condition, we execute if it is a palindrome print yes or print no<\/li>\n<\/ol>\n\n\n\n<p><strong>Method 2:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using iterative loop<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def isPalindrome(str):\n\n\tfor i in range(O, int(len(str)\/2)):\n\t    if str&#091;i] != str&#091;len(str)-i-1]:\n\t\treturn False\n\treturn True\n\n# main function\ns = \"kayak\"\nans = isPalindrome(s)\n\nif (ans):\n\tprint(\"Yes\")\n\nelse:\n\tprint(\"No\")<\/code><\/pre>\n\n\n\n<p><strong>Steps:<\/strong>&nbsp;&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A loop is run from starting to half the length and checking the first character to the last character of the string.<\/li>\n\n\n\n<li>And check from the second character to the second last character of the string.<\/li>\n\n\n\n<li>If any of the characters are mismatched, it is not a palindrome.<\/li>\n<\/ol>\n\n\n\n<p><strong>Method 3:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using the in-built function to reverse a string<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def isPalindrome(s):\n\n\trev = \u2018'.join(reversed(s))\n\n\tif (s == rev):\n\t\treturn True\n\treturn False\n\n# main function\ns = \"kayak\"\nans = isPalindrome(s)\n\nif(ans):\n\tprint(\"Yes\")\nelse:\n\tprint(\"No\")<\/code><\/pre>\n\n\n\n<p><strong>Steps:<\/strong><\/p>\n\n\n\n<p>In this method, we are using a predefined function \u2018.join\u2019<\/p>\n\n\n\n<p><strong>Method 4:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Using recursion&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def isPalindrome(s):\n\n\ts = s.lower()\n\n\t1 = len(s)\n\n\tif 1 &lt;2:\n\t\treturn True\n\n\telif s(0) == s{l - 1):\n\n\t\treturn isPalindrome(s&#091;1: l - 1])\n\telse:\n\t\treturn False\n\ns = \"Kayak\"\nans = isPalindrome(s)\n\n\tif ans:\n\t\tprint(\"Yes\")\n\n\ty else:\n\t\tprint(\"No\")<\/code><\/pre>\n\n\n\n<p><strong>Steps:<\/strong><\/p>\n\n\n\n<p>This method compares the first and last element of the string and gives the rest of the substring a recursive call to itself.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"palindrome-in-a-linked-list\"><strong>Palindrome in a Linked List<\/strong><\/h2>\n\n\n\n<p>Let\u2019s step this up and consider another data structure. What if the data is stored in a linked list? To tackle this, we need to understand linked lists. A linked list i<mark>s a data structure with a non-contiguous allocation of memory<\/mark>.<\/p>\n\n\n\n<p>We will begin by defining a linked list in python<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class ListNode:\n    def __init__(self, x):\n        self.val = x\n        self.next = None\n        \nclass Solution:\n    def __init__(self,seq):\n        \"\"\"prepends item of lists into linked list\"\"\"\n        self.head = None\n        for item in seq:\n            node = ListNode(item)\n            node.next = self.head\n            self.head = node\n\n\n    def palindrome(self):\n        \"\"\" Check if linked list is palindrome and return True\/False.\"\"\"\n        node = self.head\n        var = node #var is initialized to head\n        prev = None #initially, prev is None\n    \n        # prev approaches to middle of list till var reaches end or None \n        while var and var.next:\n            var = var.next.next\n            temp = node.next   #reverse elements of first half of list\n            node.next = prev\n            prev = node\n            node = temp\n    \n        if var:  # in case of odd num elements\n            tail = node.next\n        else:    # in case of even num elements\n            tail = node\n    \n        while prev:\n            # compare reverse element and next half elements          \n            if prev.val == tail.val:\n                tail = tail.next\n                prev = prev.next\n            else:\n                return False\n        return True\n# Test Cases\nlist_1 = Solution(&#091;7, 8, 6 ,  3 , 7 ,3 , 6, 8, 7])\nprint(&#091;7, 8, 6 ,  3 , 7 ,3 , 6, 8, 7],end='-&gt;')\nprint(list_1.palindrome())\nlist_2 = Solution(&#091;6 , 3 , 4, 6])\nprint(&#091;6 , 3 , 4, 6],end='-&gt;')\nprint(list_2.palindrome())\nlist_3 = Solution(&#091;3, 7 ,3 ])\nprint(&#091; 3 , 7, 3],end='-&gt;')\nprint(list_3.palindrome())\nlist_4 = Solution(&#091;1])\nprint(&#091;1],end='-&gt;')\nprint( list_4.palindrome())<\/code><\/pre>\n\n\n\n<p> <strong><a rel=\"noreferrer noopener nofollow\" href=\"https:\/\/www.onlinegdb.com\/online_python_interpreter\" target=\"_blank\">TEST THE CODE<\/a><\/strong> <\/p>\n\n\n\n<mark>Output -<br>3, 7, 3 - True<br>1 - True<\/mark>\n\n\n\n<p>The logic for checking if a linked list is a palindrome or not is the modified version of the one we implemented on strings and arrays. We check if the reverse of the linked list is the same as the original sequence. <mark>Instead of reversing the entire linked list and storing it in a temporary location, we reverse the first half of the linked list and check if the first half and second half match after reversal.<\/mark><\/p>\n\n\n\n<p><a href=\"https:\/\/www.mygreatlearning.com\/blog\/a-search-algorithm-in-artificial-intelligence\/\" target=\"_blank\" rel=\"noreferrer noopener\">Check out a* Algorithm in Artificial Intelligence<\/a>.<\/p>\n\n\n\n<p>Therefore, we define a function called palindrome, which has parameters node, var( stands for variable), previous, and temp. We jump to the end of the list using the variable var in line 29, and meanwhile, we store the last node data in variable prev. Therefore, comparing the prev.val and tail.val in line 41 gives us the answer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Test Cases\nlist_1 = Solution(&#091;7, 8, 6 ,  3 , 7 ,3 , 6, 8, 7])\nprint(list_1.palindrome())\nlist_2 = Solution(&#091;6 , 3 , 4, 6])\nprint(list_2.palindrome())\nlist_3 = Solution(&#091;3, 7 ,3 ])\nprint(list_3.palindrome())\nlistl_4 = Solution(&#091;1])\nPrint( list_4.palindrome())\n<\/code><\/pre>\n\n\n\n<p>In this article, we looked at palindromes inside and out and understood them thoroughly. Try developing better implementation techniques using different data structures to improve your command over coding. We shall keep posting many more articles on implementing data structures and algorithms using Python Stay tuned and Read the <a href=\"https:\/\/www.mygreatlearning.com\/blog\/top-python-books\/\" target=\"_blank\" rel=\"noreferrer noopener\">Top Ten Python Books<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"further-reading\"><strong>Further Reading<\/strong><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/factorial-program-in-python\/\" target=\"_blank\" rel=\"noreferrer noopener\">Factorial of a Number in Python<\/a> <\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/convert-list-to-string-python-program\/\" target=\"_blank\" rel=\"noreferrer noopener\">Convert list to string in Python<\/a> <\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/fibonacci-series-in-python\/\" target=\"_blank\" rel=\"noreferrer noopener\">Fibonacci series in Python<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/python-tutorial-for-beginners-a-complete-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Python Tutorial <\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/www.mygreatlearning.com\/blog\/eval-in-python\/\" target=\"_blank\" rel=\"noreferrer noopener\">Eval function in Python<\/a><\/li>\n<\/ol>\n\n\n\n<p><em>Kickstart your Python Journey with Great Learning, which offers <a href=\"https:\/\/www.mygreatlearning.com\/academy\/learn-for-free\/courses\/python-fundamentals-for-beginners\" target=\"_blank\" rel=\"noreferrer noopener\">free Python course<\/a> with world-class training.<\/em><\/p>\n\n\n\n<p>Embarking on a journey towards a career in data science opens up a world of limitless possibilities. Whether you\u2019re an aspiring data scientist or someone intrigued by the power of data, understanding the key factors that contribute to success in this field is crucial. The below path will guide you to become a proficient data scientist.<\/p>\n\n\n\n<figure class=\"wp-block-table aligncenter\"><table class=\"has-cyan-bluish-gray-background-color has-background\"><tbody><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/certificates\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Certificates<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/placements\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Placements<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/syllabus\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Syllabus<\/a><\/td><\/tr><tr><td><a href=\"https:\/\/www.mygreatlearning.com\/data-science\/courses\/eligibility\" target=\"_blank\" rel=\"noreferrer noopener\">Data Science Course Eligibility<\/a><\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>A Palindrome is a phrase which remains exactly the same when reversed.<\/p>\n","protected":false},"author":41,"featured_media":12235,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[2],"tags":[36796],"content_type":[],"class_list":["post-12141","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence","tag-python"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>What is Palindrome in Python? Codes, Algorithms and more<\/title>\n<meta name=\"description\" content=\"Palindrome in Python: Know how to check if a number is a palindrome. A Palindrome is a phrase that remains exactly the same when reversed.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is Palindrome in Python? Codes, Algorithms, and more\" \/>\n<meta property=\"og:description\" content=\"Palindrome in Python: Know how to check if a number is a palindrome. A Palindrome is a phrase that remains exactly the same when reversed.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-09-26T09:19:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-16T04:18:26+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"700\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"What is Palindrome in Python? Codes, Algorithms, and more\",\"datePublished\":\"2022-09-26T09:19:00+00:00\",\"dateModified\":\"2024-12-16T04:18:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/\"},\"wordCount\":1525,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/Feb-10-palindrome-thumbnail.png\",\"keywords\":[\"python\"],\"articleSection\":[\"AI and Machine Learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/\",\"name\":\"What is Palindrome in Python? Codes, Algorithms and more\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/Feb-10-palindrome-thumbnail.png\",\"datePublished\":\"2022-09-26T09:19:00+00:00\",\"dateModified\":\"2024-12-16T04:18:26+00:00\",\"description\":\"Palindrome in Python: Know how to check if a number is a palindrome. A Palindrome is a phrase that remains exactly the same when reversed.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/Feb-10-palindrome-thumbnail.png\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/02\\\/Feb-10-palindrome-thumbnail.png\",\"width\":1000,\"height\":700,\"caption\":\"Palindrome in Python\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/palindrome-in-python\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI and Machine Learning\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/artificial-intelligence\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"What is Palindrome in Python? Codes, Algorithms, and more\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"What is Palindrome in Python? Codes, Algorithms and more","description":"Palindrome in Python: Know how to check if a number is a palindrome. A Palindrome is a phrase that remains exactly the same when reversed.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/","og_locale":"en_US","og_type":"article","og_title":"What is Palindrome in Python? Codes, Algorithms, and more","og_description":"Palindrome in Python: Know how to check if a number is a palindrome. A Palindrome is a phrase that remains exactly the same when reversed.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2022-09-26T09:19:00+00:00","article_modified_time":"2024-12-16T04:18:26+00:00","og_image":[{"width":1000,"height":700,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png","type":"image\/png"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"What is Palindrome in Python? Codes, Algorithms, and more","datePublished":"2022-09-26T09:19:00+00:00","dateModified":"2024-12-16T04:18:26+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/"},"wordCount":1525,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png","keywords":["python"],"articleSection":["AI and Machine Learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/","url":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/","name":"What is Palindrome in Python? Codes, Algorithms and more","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png","datePublished":"2022-09-26T09:19:00+00:00","dateModified":"2024-12-16T04:18:26+00:00","description":"Palindrome in Python: Know how to check if a number is a palindrome. A Palindrome is a phrase that remains exactly the same when reversed.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png","width":1000,"height":700,"caption":"Palindrome in Python"},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/palindrome-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"AI and Machine Learning","item":"https:\/\/www.mygreatlearning.com\/blog\/artificial-intelligence\/"},{"@type":"ListItem","position":3,"name":"What is Palindrome in Python? Codes, Algorithms, and more"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png",1000,700,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail-150x150.png",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail-300x210.png",300,210,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail-768x538.png",768,538,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png",1000,700,false],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png",1000,700,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png",1000,700,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png",640,448,false],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png",96,67,false],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2020\/02\/Feb-10-palindrome-thumbnail.png",150,105,false]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":1,"uagb_excerpt":"A Palindrome is a phrase which remains exactly the same when reversed.","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/12141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=12141"}],"version-history":[{"count":175,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/12141\/revisions"}],"predecessor-version":[{"id":111112,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/12141\/revisions\/111112"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/12235"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=12141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=12141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=12141"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=12141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}