{"id":46,"date":"2023-03-30T04:56:53","date_gmt":"2023-03-30T04:56:53","guid":{"rendered":"http:\/\/www.programminginpython.com\/2023\/03\/30\/python-program-to-implement-binary-search-algorithm\/"},"modified":"2023-04-29T14:27:10","modified_gmt":"2023-04-29T14:27:10","slug":"binary-search-algorithm-python","status":"publish","type":"post","link":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/","title":{"rendered":"Python program to implement Binary Search Algorithm"},"content":{"rendered":"<p>Hello everyone! Welcome back to <a href=\"\/\" target=\"_blank\" rel=\"noopener noreferrer\">programminginpython.com<\/a>. Here in this post am going to show you how to implement a binary search algorithm in Python. In the <a href=\"https:\/\/programminginpython.com\/python-program-linear-search-algorithm\/\" target=\"_blank\" rel=\"noopener noreferrer\">previous post<\/a>, I discussed <a href=\"https:\/\/programminginpython.com\/python-program-linear-search-algorithm\/\" target=\"_blank\" rel=\"noopener noreferrer\">the Linear Search Algorithm<\/a> which is a very basic search algorithm here I will discuss Binary Search.<\/p>\n<p>Binary Search as the name suggests binary, here the list is divided into halves and then searched in each half. One notable thing about this binary search is that the list should be sorted first before executing the algorithm. The list is divided into two halves by the index, find the mid element of the list and then start to mid-1 is one list and mid+1 to end is another list, check if the element is mid, greater than it, or less than it and return the appropriate position of the key element to be found.<\/p>\n<blockquote><p><span style=\"color: #0000ff;\">Master the basics of data analysis in Python. Expand your skillset by learning scientific computing with numpy.<\/span><\/p>\n<p><span style=\"color: #0000ff;\">Take the course on Introduction to Python on <span style=\"color: #ffd343;\"><a style=\"color: #ffd343;\" href=\"https:\/\/bit.ly\/join_datacamp\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">DataCamp<\/a><\/span> here <\/span><span style=\"color: #ffd343;\"><a style=\"color: #ffd343;\" href=\"https:\/\/bit.ly\/datacamp-intro-to-python\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">https:\/\/bit.ly\/datacamp-intro-to-python<\/a><\/span><\/p><\/blockquote>\n<p> https:\/\/www.youtube.com\/watch?v=TpPi5TCSE5Q&#8221;]<\/p>\n<p style=\"text-align: center;\"><strong>You can also watch the video on YouTube <a href=\"https:\/\/www.youtube.com\/watch?v=TpPi5TCSE5Q\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a><\/strong><\/p>\n<p class=\"extra_btn_para\"><span class=\"wdg\"> <a href=\"https:\/\/github.com\/avinashn\/programminginpython.com\/blob\/master\/Algorithms\/Search%20Algorithms\/binary_search.py\" target=\"_blank\" rel=\"noopener noreferrer\"> <i class=\"fa fa-github fa-lg\"><\/i> Program on GitHub<\/a><\/span><\/p>\n<blockquote><p>Ad:<br \/>\n<span style=\"font-size: 18pt;\">Learn Python Programming Masterclass \u2013 <a href=\"https:\/\/bit.ly\/python-programming-masterclass\" target=\"_blank\" rel=\"noopener\">Enroll Now<\/a>.<\/span><br \/>\n<span style=\"font-size: 12px;\">Udemy<\/span><\/p><\/blockquote>\n<h2 class=\"post_h4\">Binary Search Algorithm \u2013 Code Visualization<\/h2>\n<p><center><iframe src=\"https:\/\/pythontutor.com\/iframe-embed.html#code=__author__%20%3D%20'Avinash'%0A%0A%0Adef%20binary_sort%28sorted_list,%20length,%20key%29%3A%0A%20%20%20%20start%20%3D%200%0A%20%20%20%20end%20%3D%20length-1%0A%20%20%20%20while%20start%20%3C%3D%20end%3A%0A%20%20%20%20%20%20%20%20mid%20%3D%20int%28%28start%20%2B%20end%29\/2%29%0A%20%20%20%20%20%20%20%20if%20key%20%3D%3D%20sorted_list%5Bmid%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20print%28%22%5CnEntered%20number%20%25d%20is%20present%20at%20position%3A%20%25d%22%20%25%20%28key,%20mid%29%29%0A%20%20%20%20%20%20%20%20%20%20%20%20return%20-1%0A%20%20%20%20%20%20%20%20elif%20key%20%3C%20sorted_list%5Bmid%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20end%20%3D%20mid%20-%201%0A%20%20%20%20%20%20%20%20elif%20key%20%3E%20sorted_list%5Bmid%5D%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20start%20%3D%20mid%20%2B%201%0A%20%20%20%20print%28%22%5CnElement%20not%20found!%22%29%0A%20%20%20%20return%20-1%0A%0Alst%20%3D%20%5B%5D%0A%0Asize%20%3D%20int%28input%28%22Enter%20size%20of%20list%3A%20%5Ct%22%29%29%0A%0Afor%20n%20in%20range%28size%29%3A%0A%20%20%20%20numbers%20%3D%20int%28input%28%22Enter%20any%20number%3A%20%5Ct%22%29%29%0A%20%20%20%20lst.append%28numbers%29%0A%0Alst.sort%28%29%0Aprint%28'%5Cn%5CnThe%20list%20will%20be%20sorted,%20the%20sorted%20list%20is%3A',%20lst%29%0A%0Ax%20%3D%20int%28input%28%22%5CnEnter%20the%20number%20to%20search%3A%20%22%29%29%0A%0Abinary_sort%28lst,%20size,%20x%29%0A&amp;codeDivHeight=400&amp;codeDivWidth=350&amp;cumulative=false&amp;curInstr=0&amp;heapPrimitives=false&amp;origin=opt-frontend.js&amp;py=3&amp;rawInputLstJSON=%5B%5D&amp;textReferences=false\" width=\"800\" height=\"500\" frameborder=\"0\"> <\/iframe><\/center><\/p>\n<h2 class=\"post_h4\">Time Complexity<\/h2>\n<table style=\"width: 100%;\">\n<tbody>\n<tr>\n<td><span style=\"color: #f2dc11;\"><strong>Best Case<\/strong><\/span><\/td>\n<td><span style=\"color: #f2dc11;\"><strong>O(1)<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #f2dc11;\"><strong>Average Case<\/strong><\/span><\/td>\n<td><span style=\"color: #f2dc11;\"><strong>O(log n)<\/strong><\/span><\/td>\n<\/tr>\n<tr>\n<td><span style=\"color: #f2dc11;\"><strong>Worst Case<\/strong><\/span><\/td>\n<td><span style=\"color: #f2dc11;\"><strong>O(log n)<\/strong><\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p class=\"extra_btn_para\"><span class=\"wdg\"> <a href=\"https:\/\/github.com\/avinashn\/programminginpython.com\/blob\/master\/Algorithms\/Search%20Algorithms\/binary_search.py\" target=\"_blank\" rel=\"noopener noreferrer\"> <i class=\"fa fa-github fa-lg\"><\/i> Program on GitHub<\/a><\/span><\/p>\n<h2 class=\"post_h4\">Algorithm<\/h2>\n<p>Given a list\u00a0L of n elements with values or records L0, L1, \u2026, Ln-1, sorted in ascending order, and given key\/target value K, binary search is used to find the index of K in L<\/p>\n<ol>\n<li>Set a variable <code>start<\/code> to <code>0<\/code> and another variable <code>end<\/code> to <code>n-1<\/code>(size of the list)<\/li>\n<li>if <code>start<\/code> &gt; <code>end<\/code> break the algorithm, as it works only on sorted lists<\/li>\n<li>calculate <code>mid<\/code> as <code>(start + end)\/2<\/code><\/li>\n<li>if the key element is\n<ol>\n<li><strong>equal to mid<\/strong>, the search is done, returns the position of mid<\/li>\n<li><strong>greater than mid<\/strong>, set <code>start<\/code> to <code>mid + 1<\/code> and repeat step 2<\/li>\n<li><strong>less than mid<\/strong>, set <code>end<\/code> to <code>mid - 1<\/code> and repeat step 2<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<h2 class=\"post_h4\">Program<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">__author__ = 'Avinash'\r\n\r\n\r\ndef binary_sort(sorted_list, length, key):\r\n    start = 0\r\n    end = length-1\r\n    while start &lt;= end:\r\n        mid = int((start + end)\/2)\r\n        if key == sorted_list[mid]:\r\n            print(\"\\nEntered number %d is present at position: %d\" % (key, mid))\r\n            return -1\r\n        elif key &lt; sorted_list[mid]:\r\n            end = mid - 1\r\n        elif key &gt; sorted_list[mid]:\r\n            start = mid + 1\r\n    print(\"\\nElement not found!\")\r\n    return -1\r\n\r\nlst = []\r\n\r\nsize = int(input(\"Enter size of list: \\t\"))\r\n\r\nfor n in range(size):\r\n    numbers = int(input(\"Enter any number: \\t\"))\r\n    lst.append(numbers)\r\n\r\nlst.sort()\r\nprint('\\n\\nThe list will be sorted, the sorted list is:', lst)\r\n\r\nx = int(input(\"\\nEnter the number to search: \"))\r\n\r\nbinary_sort(lst, size, x)<\/pre>\n<p class=\"extra_btn_para\"><span class=\"wdg\"> <a href=\"https:\/\/github.com\/avinashn\/programminginpython.com\/blob\/master\/Algorithms\/Search%20Algorithms\/binary_search.py\" target=\"_blank\" rel=\"noopener noreferrer\"> <i class=\"fa fa-github fa-lg\"><\/i> Program on GitHub<\/a><\/span><\/p>\n<h2 class=\"post_h4\">Output<\/h2>\n<figure id=\"attachment_744\" aria-describedby=\"caption-attachment-744\" style=\"width: 929px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-744 lazyload\" data-src=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_3.png\" alt=\"Binary Search Algorithm in Python\" width=\"929\" height=\"305\" data-srcset=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_3.png 929w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_3.png 300w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_3.png 768w\" data-sizes=\"(max-width: 640px) 100vw, 640px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 929px; --smush-placeholder-aspect-ratio: 929\/305;\" \/><figcaption id=\"caption-attachment-744\" class=\"wp-caption-text\">Binary Search Algorithm in Python<\/figcaption><\/figure>\n<figure id=\"attachment_796\" class=\"wp-caption aligncenter\" style=\"width: 941px;\" aria-describedby=\"caption-attachment-796\"><img decoding=\"async\" class=\"size-full wp-image-745 lazyload\" data-src=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_2.png\" alt=\"Binary Search Algorithm in Python\" width=\"941\" height=\"293\" data-srcset=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_2.png 941w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_2.png 300w, https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_2.png 768w\" data-sizes=\"(max-width: 640px) 100vw, 640px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 941px; --smush-placeholder-aspect-ratio: 941\/293;\" \/><\/figure>\n<p>Feel free to look at some other <a href=\"http:\/\/programminginpython.com\/category\/algorithms\/\" target=\"_blank\" rel=\"noopener noreferrer\">algorithms<\/a> <a href=\"http:\/\/programminginpython.com\/category\/algorithms\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> or some programs on <a href=\"http:\/\/programminginpython.com\/category\/programs-on-lists\/\" target=\"_blank\" rel=\"noopener noreferrer\">lists<\/a>\u00a0<a href=\"http:\/\/programminginpython.com\/category\/programs-on-lists\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> or have a look at <a href=\"http:\/\/programminginpython.com\/python-programs\/\" target=\"_blank\" rel=\"noopener noreferrer\">all the programs<\/a> on Python <a href=\"http:\/\/programminginpython.com\/python-programs\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello everyone! Welcome back to programminginpython.com. Here in this post am going to show you how to implement a binary search algorithm in python. In the previous post, I discussed the Linear Search Algorithm which &hellip;<\/p>\n","protected":false},"author":1,"featured_media":339,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,8],"tags":[90,101,100],"class_list":["post-46","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-algorithms","category-searching-algorithms","tag-algorithms","tag-binary-search-algorithm","tag-searching-algorithms"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python program to implement Binary Search Algorithm<\/title>\n<meta name=\"description\" content=\"A simple Python program to implement Binary Search Algorithm, here we divide the list into 2 sorted halves and search the item in each list.\" \/>\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.programminginpython.com\/binary-search-algorithm-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python program to implement Binary Search Algorithm\" \/>\n<meta property=\"og:description\" content=\"A simple Python program to implement Binary Search Algorithm, here we divide the list into 2 sorted halves and search the item in each list.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Programming In Python\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/programminginpython\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-30T04:56:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-04-29T14:27:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_FB.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"AVINASH NETHALA\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@python_pip\" \/>\n<meta name=\"twitter:site\" content=\"@python_pip\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"AVINASH NETHALA\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python program to implement Binary Search Algorithm","description":"A simple Python program to implement Binary Search Algorithm, here we divide the list into 2 sorted halves and search the item in each list.","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.programminginpython.com\/binary-search-algorithm-python\/","og_locale":"en_US","og_type":"article","og_title":"Python program to implement Binary Search Algorithm","og_description":"A simple Python program to implement Binary Search Algorithm, here we divide the list into 2 sorted halves and search the item in each list.","og_url":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/","og_site_name":"Programming In Python","article_publisher":"https:\/\/www.facebook.com\/programminginpython","article_published_time":"2023-03-30T04:56:53+00:00","article_modified_time":"2023-04-29T14:27:10+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_FB.png","type":"image\/png"}],"author":"AVINASH NETHALA","twitter_card":"summary_large_image","twitter_creator":"@python_pip","twitter_site":"@python_pip","twitter_misc":{"Written by":"AVINASH NETHALA","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#article","isPartOf":{"@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/"},"author":{"name":"AVINASH NETHALA","@id":"https:\/\/www.programminginpython.com\/#\/schema\/person\/9a3c14fe46d422ebf783ee61de1e788c"},"headline":"Python program to implement Binary Search Algorithm","datePublished":"2023-03-30T04:56:53+00:00","dateModified":"2023-04-29T14:27:10+00:00","mainEntityOfPage":{"@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/"},"wordCount":374,"commentCount":0,"publisher":{"@id":"https:\/\/www.programminginpython.com\/#organization"},"image":{"@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_WP1.png","keywords":["algorithms","binary search algorithm","searching algorithms"],"articleSection":["Algorithms","Searching Algorithms"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/","url":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/","name":"Python program to implement Binary Search Algorithm","isPartOf":{"@id":"https:\/\/www.programminginpython.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#primaryimage"},"image":{"@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_WP1.png","datePublished":"2023-03-30T04:56:53+00:00","dateModified":"2023-04-29T14:27:10+00:00","description":"A simple Python program to implement Binary Search Algorithm, here we divide the list into 2 sorted halves and search the item in each list.","breadcrumb":{"@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#primaryimage","url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_WP1.png","contentUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_WP1.png","width":1920,"height":400,"caption":"Python program to implement Binary Search Algorithm"},{"@type":"BreadcrumbList","@id":"https:\/\/www.programminginpython.com\/binary-search-algorithm-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.programminginpython.com\/"},{"@type":"ListItem","position":2,"name":"Python program to implement Binary Search Algorithm"}]},{"@type":"WebSite","@id":"https:\/\/www.programminginpython.com\/#website","url":"https:\/\/www.programminginpython.com\/","name":"Programming In Python","description":"All About Python","publisher":{"@id":"https:\/\/www.programminginpython.com\/#organization"},"alternateName":"pip","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.programminginpython.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.programminginpython.com\/#organization","name":"Programming In Python","alternateName":"PIP","url":"https:\/\/www.programminginpython.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.programminginpython.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/04\/pip_logo_500_500.png","contentUrl":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/04\/pip_logo_500_500.png","width":500,"height":500,"caption":"Programming In Python"},"image":{"@id":"https:\/\/www.programminginpython.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/programminginpython","https:\/\/x.com\/python_pip","https:\/\/www.youtube.com\/programminginpython","https:\/\/github.com\/avinashn\/programminginpython.com"]},{"@type":"Person","@id":"https:\/\/www.programminginpython.com\/#\/schema\/person\/9a3c14fe46d422ebf783ee61de1e788c","name":"AVINASH NETHALA","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.programminginpython.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ed52e7670d7db94820c7430d324103ccdecb16d86611d5b29064aa9ce25a958b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed52e7670d7db94820c7430d324103ccdecb16d86611d5b29064aa9ce25a958b?s=96&d=mm&r=g","caption":"AVINASH NETHALA"},"sameAs":["https:\/\/www.programminginpython.com\/"],"url":"https:\/\/www.programminginpython.com\/author\/avinash\/"}]}},"jetpack_featured_media_url":"https:\/\/www.programminginpython.com\/wp-content\/uploads\/2023\/03\/binary_search_WP1.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":5,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":747,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/posts\/46\/revisions\/747"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/media\/339"}],"wp:attachment":[{"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.programminginpython.com\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}