{"id":10754,"date":"2022-11-24T11:19:04","date_gmt":"2022-11-24T11:19:04","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=10754"},"modified":"2023-05-17T06:51:53","modified_gmt":"2023-05-17T06:51:53","slug":"python-program-to-check-palindrome-number","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/","title":{"rendered":"Python Program to Check Palindrome Number"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg\" alt=\"\" \/><\/p>\n<p>A palindrome number is a number that reads the same forwards and backward. In other words, it remains unchanged when its digits are reversed. For example, 121, 454, and 12321 are all palindrome numbers.<\/p>\n<p>Palindrome numbers have interesting properties and are commonly used in number-related puzzles and programming exercises. They can also be found in various real-world applications, such as identifying symmetrical patterns or in certain number systems.<\/p>\n<h2>What are Palindrome Numbers?<\/h2>\n<p>Palindrome numbers are those numbers that read the same from front and back. For instance, in the above example, the number 121 is a palindrome as when we read it from left to right, it reads 121 and from right to left also, it reads 121 only.<\/p>\n<p>However, the number 1212 is not a palindrome. This is because from left to right, it reads 1212 however from right to left, it reads 2121.<\/p>\n<p>So, now that we know what palindrome numbers are, let us now understand the approach to writing the palindrome program in Python.<\/p>\n<h3>Understand with Example<\/h3>\n<p>You are given a number as input. You have to tell whether the number is Palindrome or not. For instance, consider the 2 inputs shown below.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287894033-Python%20Program%20to%20Check%20Palindrome%20Number%201.png\" alt=\"\" \/><\/p>\n<p>So, before understanding the solution, let us first understand what are the palindrome numbers.<\/p>\n<h2>How to Check Given Number is Palindrome using Reversal Method<\/h2>\n<p>As we can see that the meaning of a palindrome is so simple, and so is the approach to this solution. We can clearly see from the above example that a palindrome will remain the same if we reverse the digits.<\/p>\n<p>For instance, if there is a number 1002 and we reverse its digits, the number becomes 2001. Since the number and its reverse are not equal, this number is not a palindrome. However, the number 1001 on reversing gives 1001. Since the number and its reverse are equal, 1001 is a palindrome.<\/p>\n<p>So, now we just need to understand the algorithm to reverse a number. This is shown below.<\/p>\n<h3>Reverse a Number in Python<\/h3>\n<p>In order to reverse a number in Python, we will follow the following algorithm.<\/p>\n<ol>\n<li>Initialize the variable reverse = 0.<\/li>\n<li>Take the modulus of the number by 10. This will be stored in the variable rem i.e. remainder.<\/li>\n<li>Now, do rev = rev * 10 + rem.<\/li>\n<li>Divide the number by 10. Please note that here you have to perform integer or floor division i.e. don\u2019t do N\/10, instead do N\/\/10.<\/li>\n<li>Repeat the steps from 2 to 4 till the number becomes 0.<\/li>\n<\/ol>\n<p>So, let us take example 98634 as shown below.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287894033-Python%20Program%20to%20Check%20Palindrome%20Number%202.png\" alt=\"\" \/><\/p>\n<p>So, in the first step, we have rev = 4, and the number is reduced to 9863. Now, let us divide the number by 10 again.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287894043-Python%20Program%20to%20Check%20Palindrome%20Number%203.png\" alt=\"\" \/><\/p>\n<p>So, in the second step, we have rev = 43, and the number is reduced to 986. Now, let us divide the number by 10 again.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287894043-Python%20Program%20to%20Check%20Palindrome%20Number%204.png\" alt=\"\" \/><\/p>\n<p>So, in the third step, we have rev = 436, and the number is reduced to 98. Now, let us divide the number by 10 again.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287894044-Python%20Program%20to%20Check%20Palindrome%20Number%205.png\" alt=\"\" \/><\/p>\n<p>So, in the fourth step, we have rev = 4368, and the number is reduced to 9. Now, let us divide the number by 10 again.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287894045-Python%20Program%20to%20Check%20Palindrome%20Number%206.png\" alt=\"\" \/><\/p>\n<p>So, in the fourth step, we have rev = 43689, and the number is reduced to 0. Since the number has now become 0, we will stop the division.<\/p>\n<p>So, now that we know how to reverse a number in Python, what we have to do is to reverse the input number. If the reverse is the same as the input number, then we can say that the input number is a palindrome, else it is not a palindrome.<\/p>\n<p>Now that we have understood the procedure, let us write the code for the same.<\/p>\n<h2>Program to Check Palindrome Number in Python<\/h2>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_10729 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_10729 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_10729 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_10729 .wpsm_nav-tabs > li.active > a, #tab_container_10729 .wpsm_nav-tabs > li.active > a:hover, #tab_container_10729 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_10729 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_10729 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_10729 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_10729 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_10729 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_10729 .wpsm_nav-tabs > li > a:hover , #tab_container_10729 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_10729 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_10729 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_10729 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_10729 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_10729 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_10729 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_10729 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_10729 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_10729 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_10729 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_10729 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_10729\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_10729\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_10729_1\" aria-controls=\"tabs_desc_10729_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>Python<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_10729\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_10729_1\">\r\n\t\t\t\t\t\t\t\t<!-- wp:enlighter\/codeblock {\"language\":\"python\"} -->\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\r\nN = int(input())\r\nrev = 0\r\noN = N\r\nrem = 0\r\n\r\nwhile N &gt; 0:\r\n    rem = N % 10\r\n    rev = rev * 10 + rem\r\n    N \/\/= 10\r\n    \r\nif rev == oN:\r\n    print(&quot;The number is a palindrome&quot;)\r\nelse:\r\n    print(&quot;The number is not a palindrome&quot;)\r\n<\/pre>\r\n<!-- \/wp:enlighter\/codeblock -->\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_10729 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_10729 a\"),jQuery(\"#tab-content_10729\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t\n<p><strong>Time Complexity:<\/strong> The time complexity is O(log10N). This is because to reverse a number, we have to extract all the digits of the number by dividing it by 10 till it becomes 0.<\/p>\n<p><strong>Space Complexity (Auxiliary Space):<\/strong> Since we have note used any extra space, the auxiliary space or the extra space is O(1).<\/p>\n<p><strong>Conclusion<\/strong><br \/>\nIn conclusion, checking whether a number is a palindrome involves comparing the number to its reverse. If the number remains the same when its digits are reversed, it is considered a palindrome number.<\/p>\n<p>To check for palindromes, you can compare the digits from the beginning and the end of the number. If the corresponding digits match throughout, the number is a palindrome. Leading zeros are typically ignored when checking for palindromes.<\/p>\n<p>Palindrome numbers are interesting and commonly used in puzzles, algorithms, and programming challenges. They have various applications, including identifying symmetrical patterns and number-related computations.<\/p>\n<h2>Frequently Asked Questions<\/h2>\n<p><strong>Q1. Can negative numbers be palindromes?<\/strong><br \/>\n<strong>Ans.<\/strong> No, negative numbers cannot be palindromes because the &#8216;-&#8216; sign will not be present when the digits are reversed. Palindromes are typically defined as non-negative integers.<\/p>\n<p><strong>Q2. Do leading zeros affect the determination of a palindrome number?<\/strong><br \/>\n<strong>Ans.<\/strong> Leading zeros are generally ignored when determining a palindrome number. For example, &quot;010&quot; is considered a palindrome because the digits &quot;0&quot; and &quot;1&quot; are the same when read forwards and backward.<\/p>\n<p><strong>Q3. How can I check if a number is a palindrome using programming?<\/strong><br \/>\n<strong>Ans.<\/strong> In most programming languages, you can convert the number to a string and compare it with its reverse using string manipulation techniques. Alternatively, you can use mathematical operations to reverse the digits of the number and compare it with the original number.<\/p>\n<p><strong>Q4. Can palindrome numbers be of any length?<\/strong><br \/>\n<strong>Ans.<\/strong> Yes, palindrome numbers can be of any length. They can range from single-digit numbers to very large numbers with multiple digits.<\/p>\n<p><strong>Q5. Are there any mathematical properties or formulas related to palindrome numbers?<\/strong><br \/>\n<strong>Ans.<\/strong> Palindrome numbers do not have specific mathematical properties or formulas. However, they are often used in mathematical puzzles, algorithms, and problem-solving scenarios.<\/p>\n<p><strong>Other Python Programs<\/strong><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-reverse-a-number\/\" title=\"Python program to reverse a number\">Python program to reverse a number<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/heap\/python-program-for-heap-sort\/\" title=\"Python program for heap sort\">Python program for heap sort<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-check-armstrong-number\/\" title=\"Python program to check armstrong number\">Python program to check armstrong number<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-check-leap-year\/\" title=\"Python program to check leap year\">Python program to check leap year<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-convert-celsius-to-fahrenheit\/\" title=\"Python program to convert celsius to fahrenheit\">Python program to convert celsius to fahrenheit<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-find-factorial-of-a-number\/\" title=\"Python program to find factorial of a number\">Python program to find factorial of a number<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-reverse-a-linked-list\/\" title=\"Python program to reverse a linked list\">Python program to reverse a linked list<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/linked-list\/python-program-to-find-the-middle-of-a-linked-list-using-only-one-traversal\/\" title=\"Python Program to find the middle of a linked list using only one traversal\">Python Program to find the middle of a linked list using only one traversal<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-add-two-numbers\/\" title=\"Python Program to Add Two Numbers\">Python Program to Add Two Numbers<\/a><br \/>\n<a href=\"https:\/\/prepbytes.com\/blog\/python\/python-program-to-print-the-fibonacci-series\/\" title=\"Python Program to Print the Fibonacci Series\">Python Program to Print the Fibonacci Series<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A palindrome number is a number that reads the same forwards and backward. In other words, it remains unchanged when its digits are reversed. For example, 121, 454, and 12321 are all palindrome numbers. Palindrome numbers have interesting properties and are commonly used in number-related puzzles and programming exercises. They can also be found in [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[154],"tags":[],"class_list":["post-10754","post","type-post","status-publish","format-standard","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Palindrome Number Program in Python<\/title>\n<meta name=\"description\" content=\"Know how to write a program to detect whether a number is a palindrome or not in Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Palindrome Number Program in Python\" \/>\n<meta property=\"og:description\" content=\"Know how to write a program to detect whether a number is a palindrome or not in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-24T11:19:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-17T06:51:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"Python Program to Check Palindrome Number\",\"datePublished\":\"2022-11-24T11:19:04+00:00\",\"dateModified\":\"2023-05-17T06:51:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/\"},\"wordCount\":1025,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/\",\"name\":\"Palindrome Number Program in Python\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg\",\"datePublished\":\"2022-11-24T11:19:04+00:00\",\"dateModified\":\"2023-05-17T06:51:53+00:00\",\"description\":\"Know how to write a program to detect whether a number is a palindrome or not in Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Program to Check Palindrome Number\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Palindrome Number Program in Python","description":"Know how to write a program to detect whether a number is a palindrome or not in Python.","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:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/","og_locale":"en_US","og_type":"article","og_title":"Palindrome Number Program in Python","og_description":"Know how to write a program to detect whether a number is a palindrome or not in Python.","og_url":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2022-11-24T11:19:04+00:00","article_modified_time":"2023-05-17T06:51:53+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"Python Program to Check Palindrome Number","datePublished":"2022-11-24T11:19:04+00:00","dateModified":"2023-05-17T06:51:53+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/"},"wordCount":1025,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/","url":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/","name":"Palindrome Number Program in Python","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg","datePublished":"2022-11-24T11:19:04+00:00","dateModified":"2023-05-17T06:51:53+00:00","description":"Know how to write a program to detect whether a number is a palindrome or not in Python.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1669287893965-Python%20Program%20to%20Check%20Palindrome%20Number.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/python-program-to-check-palindrome-number\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/prepbytes.com\/blog\/category\/python\/"},{"@type":"ListItem","position":3,"name":"Python Program to Check Palindrome Number"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/10754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=10754"}],"version-history":[{"count":4,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/10754\/revisions"}],"predecessor-version":[{"id":16405,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/10754\/revisions\/16405"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=10754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=10754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=10754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}