{"id":12038,"date":"2020-10-20T09:39:51","date_gmt":"2020-10-20T16:39:51","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=12038"},"modified":"2023-12-01T04:03:13","modified_gmt":"2023-12-01T12:03:13","slug":"python-sort","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-sort\/","title":{"rendered":"Python Sort(): A How-To Guide"},"content":{"rendered":"\n<p><em>The Python sort() method sorts a list in ascending order by its values. You can sort a list in descending order by using the reverse parameter. sort() optionally accepts a function that lets you specify a custom sort.<\/em><\/p>\n\n\n\n<p>All coders eventually encounter a situation where they have to sort items or data. Sorting is critical in many contexts. You might need to sort usernames in reverse alphabetical order or get a list of email recipients in alphabetical order.<\/p>\n\n\n\n<p><a href=\"https:\/\/careerkarma.com\/blog\/what-python-is-used-for\/\">Python<\/a> has a built-in function to help developers sort lists: <em>sort()<\/em>. The sort function offers many features to customize list ordering so you can arrange <a href=\"https:\/\/careerkarma.com\/blog\/python-list-methods\/\">Python lists<\/a> in the best way for your program.<\/p>\n\n\n\n<p>In this tutorial, we\u2019ll cover the basics of sorting in Python and discuss how to use the <em>sort()<\/em> function.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<label for=\"ez-toc-cssicon-toggle-item-69db172e06ea9\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #000000;color:#000000\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #000000;color:#000000\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69db172e06ea9\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/careerkarma.com\/blog\/python-sort\/#python-sort-list\" >Python Sort List<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/careerkarma.com\/blog\/python-sort\/#sort-python-keys\" >Sort Python Keys<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/careerkarma.com\/blog\/python-sort\/#conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"python-sort-list\"><\/span>Python Sort List<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The sort() function orders lists in ascending order. You can use a custom sort or sort in descending order by specifying additional parameters. These parameters are optional.<\/p>\n\n\n\n<p>Let&#8217;s take a look at the syntax for the sort() method:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>sort(reverse=True, key=function)<\/pre><\/div>\n\n\n\n<p>Our sort() method accepts two optional arguments:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>reverse: Specifying the value True sorts a list in descending order.<\/li><li>key: A function that sorts the list.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Python Sort List: Ascending Order<\/h3>\n\n\n\n<p>Below, we define a Python <a href=\"https:\/\/careerkarma.com\/blog\/python-array\/\">array<\/a>. This array contains a list of numbers. These numbers are not in any particular order. To sort our array, we can use the sort() function:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>data = [9, 12, 8, 4, 6]\ndata.sort()\n\nprint(data)<\/pre><\/div>\n\n\n\n<p>Our code returns the following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>[4, 6, 8, 9, 12]<\/pre><\/div>\n\n\n\n<p>On the first line of our code, we declared a list of numbers that appear in random order.<\/p>\n\n\n\n<p>Next, we use the <em>sort()<\/em> function with no arguments. This orders our original list in ascending alphabetical order. Then, on the final line, our code prints the sorted data.<\/p>\n\n\n\n<p>The <em>sort()<\/em> function does changes our original <a href=\"https:\/\/careerkarma.com\/blog\/java-sort-arraylist\/\">array<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sort List in Python: Descending Order<\/h3>\n\n\n\n<p>The reverse argument sorts a list in descending order when it is set to True. By default, <em>reverse<\/em> is set to <em>False<\/em>, which means our final list will be in ascending order.<\/p>\n\n\n\n<p>Below, we have a list of student names. We want to sort this list in reverse alphabetical order. To do so, we&#8217;ll use the sort() method with the reverse argument:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>students = ['Hannah', 'Arnold', 'Paul', 'Chris', 'Kathy']\nstudents.sort(reverse=True)\n\nprint(students)<\/pre><\/div>\n\n\n\n<p>Our code returns the list of student names in reverse alphabetical order:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>['Paul', 'Kathy', 'Hannah', 'Chris','Arnold']<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"sort-python-keys\"><\/span>Sort Python Keys<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We can sort our lists using our own methods of sorting. For example, we can sort an array by the length of the strings in the array.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sort By String Length<\/h3>\n\n\n\n<p>By using the <em>key<\/em> parameter, we can define our own custom sort. Here is an example of the <em>key<\/em> argument in action that will sort our list by the length of its component strings:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>students = ['Sophie', 'Alexander', 'Paul', 'Chris', 'Ann']\nsortedStudents = sorted(students, key=len)\nprint(sortedStudents)<\/pre><\/div>\n\n\n\n<p>Our code returns the following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>['Ann', 'Paul', 'Chris', 'Sophie', 'Alexander']<\/pre><\/div>\n\n\n\n<p>Here, our code has sorted our list by the length of the strings. <em>Ann<\/em>, a three-letter-long name, comes first, and <em>Alexander<\/em>, whose name consists of nine characters, comes last in our list.<\/p>\n\n\n\n<p>In our above example, we tell our code to sort by <em>len()<\/em>, which is the built-in <a href=\"https:\/\/careerkarma.com\/blog\/python-len\/\">Python function for the length of an object<\/a>. Each string in our array is run through <em>len()<\/em>. Then, the final list is ordered.<\/p>\n\n\n\n<p>Similarly, we could have used <em>str.upper<\/em> to sort in alphabetical order by the uppercase letter in each string. Or, we could have used another Python function entirely to sort our list.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sort by JSON Contents<\/h3>\n\n\n\n<p>Keys also allow you to define your own functions that state how a sort should be performed. Here\u2019s an example of a sort that will reverse a JSON array by a certain value. In this case, the test scores of certain students:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>def sortFunction(value):\n\treturn value[&quot;test_score&quot;]\n\nstudents = [\n{\n\t\t&quot;name&quot;: &quot;Sophie&quot;,\n\t\t&quot;test_score&quot;: 75\n},\n{\n\t\t&quot;name&quot;: &quot;Ann&quot;,\n\t\t&quot;test_score&quot;: 67\n},\n{\n\t\t&quot;name&quot;: &quot;Chris&quot;,\n\t\t&quot;test_score&quot;: 73\n}\n\n]\n\nsortedStudents = sorted(students, key=sortFunction)\nprint(sortedStudents)<\/pre><\/div>\n\n\n\n<p>Our code returns the following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>[{'name': 'Ann', 'test_score': 67}, {'name': 'Chris', 'test_score': 73}, {'name': 'Sophie', 'test_score': 75}]<\/pre><\/div>\n\n\n\n<p>Our code has sorted the students by their test scores.<\/p>\n\n\n\n<p>Firstly, our program defines a function called <em>sortFunction<\/em>, which will sort our JSON array based on the value of <em>test_score<\/em> when called. Then we declare a JSON array called <em>students<\/em> with student names and their test scores.<\/p>\n\n\n\n<p>Next, we sort our students using our custom sort function by calling <em>sortFunction<\/em> as our key. On the final line, our code prints out our sorted list.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this tutorial, we have broken down how to use the sort() function in Python to sort lists. We discussed how to use <em>sort()<\/em> on different data types and the <em>reverse<\/em> parameter to reverse list order. We also covered how to use keys to conduct more granular sorts.<\/p>\n\n\n\n<p>To learn more about coding in Python, read our complete guide on <a href=\"https:\/\/careerkarma.com\/blog\/how-to-learn-python\/\">how to learn Python<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"The Python sort() method sorts a list in ascending order by its values. You can sort a list in descending order by using the reverse parameter. sort() optionally accepts a function that lets you specify a custom sort. All coders eventually encounter a situation where they have to sort items or data. Sorting is critical&hellip;","protected":false},"author":240,"featured_media":14152,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-12038","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Python","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":null,"is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Sort(): A How-To Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"The Python sort() function sorts and orders a list in a number of ways. Learn how to use this useful function in this Career Karma article.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/python-sort\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Sort(): A How-To Guide\" \/>\n<meta property=\"og:description\" content=\"The Python sort() function sorts and orders a list in a number of ways. Learn how to use this useful function in this Career Karma article.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-sort\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-20T16:39:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:03:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"840\" \/>\n\t<meta property=\"og:image:height\" content=\"472\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\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:\/\/careerkarma.com\/blog\/python-sort\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python Sort(): A How-To Guide\",\"datePublished\":\"2020-10-20T16:39:51+00:00\",\"dateModified\":\"2023-12-01T12:03:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/\"},\"wordCount\":749,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-sort\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-sort\/\",\"name\":\"Python Sort(): A How-To Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg\",\"datePublished\":\"2020-10-20T16:39:51+00:00\",\"dateModified\":\"2023-12-01T12:03:13+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"The Python sort() function sorts and orders a list in a number of ways. Learn how to use this useful function in this Career Karma article.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-sort\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg\",\"width\":840,\"height\":472,\"caption\":\"Python Sort\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-sort\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/careerkarma.com\/blog\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Python Sort(): A How-To Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Sort(): A How-To Guide | Career Karma","description":"The Python sort() function sorts and orders a list in a number of ways. Learn how to use this useful function in this Career Karma article.","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:\/\/careerkarma.com\/blog\/python-sort\/","og_locale":"en_US","og_type":"article","og_title":"Python Sort(): A How-To Guide","og_description":"The Python sort() function sorts and orders a list in a number of ways. Learn how to use this useful function in this Career Karma article.","og_url":"https:\/\/careerkarma.com\/blog\/python-sort\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-10-20T16:39:51+00:00","article_modified_time":"2023-12-01T12:03:13+00:00","og_image":[{"width":840,"height":472,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-sort\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-sort\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python Sort(): A How-To Guide","datePublished":"2020-10-20T16:39:51+00:00","dateModified":"2023-12-01T12:03:13+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-sort\/"},"wordCount":749,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-sort\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-sort\/","url":"https:\/\/careerkarma.com\/blog\/python-sort\/","name":"Python Sort(): A How-To Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg","datePublished":"2020-10-20T16:39:51+00:00","dateModified":"2023-12-01T12:03:13+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"The Python sort() function sorts and orders a list in a number of ways. Learn how to use this useful function in this Career Karma article.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-sort\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-sort\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-sort\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/02\/python-sort.jpg","width":840,"height":472,"caption":"Python Sort"},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-sort\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/careerkarma.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Python Sort(): A How-To Guide"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=12038"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/12038\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/14152"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=12038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=12038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=12038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}