{"id":4435,"date":"2022-12-23T08:46:00","date_gmt":"2022-12-23T08:46:00","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=4435"},"modified":"2022-12-22T17:50:14","modified_gmt":"2022-12-22T17:50:14","slug":"swap-first-and-last-digit-of-a-number-in-python","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/swap-first-and-last-digit-of-a-number-in-python\/","title":{"rendered":"Swap First and Last Digit of a Number in Python"},"content":{"rendered":"<p align=\"JUSTIFY\">In this video, we are going to understand and implement a simple Python program, where we are going to swap the first and last digits in the given number. For example, if we have the number 12345, the output should be 52341, where the first and last digits are swapped in the number. The logic behind this program is very simple, and once you are familiar with the logic, you can also implement the program easily. For understanding this program, one needs to be familiar with the concepts like loops, math functions, and basic operators in Python.<\/p>\n<h2 style=\"text-align: center;\" align=\"JUSTIFY\">Python program to swap first and last digit in a given number<\/h2>\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<div class=\"youtube-embed\" data-video_id=\"ahKBhMXENWA\"><iframe loading=\"lazy\" title=\"Swap First and Last Digit of a Number in Python\" width=\"696\" height=\"392\" src=\"https:\/\/www.youtube.com\/embed\/ahKBhMXENWA?feature=oembed&#038;enablejsapi=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<p>&nbsp;I hope you find this video \u2018Swap First and Last Digit of a Number in Python\u2019 helpful for you\u2026<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this video, we are going to understand and implement a simple Python program, where we are going to swap the first and last digits in the given number. For example, if we have the number 12345, the output should be 52341, where the first and last digits are swapped in the number. The logic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4437,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[26,74],"class_list":{"0":"post-4435","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python","8":"tag-python","9":"tag-swap-first-and-last-digit-of-a-number-in-python"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=4435"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4435\/revisions"}],"predecessor-version":[{"id":4440,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4435\/revisions\/4440"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media\/4437"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=4435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=4435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=4435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}