{"id":1056,"date":"2023-04-06T21:45:00","date_gmt":"2023-04-06T16:15:00","guid":{"rendered":"https:\/\/geekpython.in\/?p=1056"},"modified":"2023-08-15T13:38:10","modified_gmt":"2023-08-15T08:08:10","slug":"python-sort-vs-sorted","status":"publish","type":"post","link":"https:\/\/geekpython.in\/python-sort-vs-sorted","title":{"rendered":"Difference Between sort() And sorted() In Python"},"content":{"rendered":"\n<p>We&#8217;ll compare the Python&#8217;s list&nbsp;<code>sort()<\/code>&nbsp;and&nbsp;<code>sorted()<\/code>&nbsp;functions in this article. We&#8217;ll learn about these functions, such as what they are and how they differ programmatically and syntactically.<\/p>\n\n\n\n<p>Python&nbsp;<code>sort()<\/code>&nbsp;and&nbsp;<code>sorted()<\/code>&nbsp;are used to sort the data in ascending or descending order. Their goals are the same but are used in different conditions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-sort\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-sort\"><\/a>sort()<\/h2>\n\n\n\n<p>The&nbsp;<code>sort()<\/code>&nbsp;function is connected to the Python list and&nbsp;<strong>by default, sorts the list&#8217;s contents in ascending order<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># List of names\ndata = ['Sachin', 'Yogesh', 'Yashwant', 'Rishu']\nprint(f'Original Data: {data}')\n\n# Using list.sort() function\ndata.sort()\n# Printing sorted data\nprint(f'Sorted Data: {data}')\n\n----------\nOriginal Data: ['Sachin', 'Yogesh', 'Yashwant', 'Rishu']\nSorted Data: ['Rishu', 'Sachin', 'Yashwant', 'Yogesh']<\/pre><\/div>\n\n\n\n<p>The code above sorts the names in ascending order within the list&nbsp;<code>data<\/code>. That was the most fundamental use of the list&nbsp;<code>sort()<\/code>&nbsp;function. We&#8217;ll see more examples where we&#8217;ll manipulate the function&#8217;s parameters.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-syntax\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-syntax\"><\/a>Syntax<\/h3>\n\n\n\n<p><code>list.sort(reverse=False, key=None)<\/code><\/p>\n\n\n\n<p>Here<\/p>\n\n\n\n<p><code>reverse<\/code>&nbsp;&#8211; Defaults to&nbsp;<code>False<\/code>. If&nbsp;<code>reverse=True<\/code>, the data will be sorted in&nbsp;<strong>descending order<\/strong>.<\/p>\n\n\n\n<p><code>key<\/code>&nbsp;&#8211; Defaults to&nbsp;<code>None<\/code>. We can specify a&nbsp;<strong>user-defined function<\/strong>&nbsp;to customize the sorting.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-examples\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-examples\"><\/a>Examples<\/h3>\n\n\n\n<p>We&#8217;ll play around with these parameters and try with data having different data types to get a better understanding of this function.<\/p>\n\n\n\n<p><strong>Example 1 &#8211; List having different characters<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># Original List\ntyp_data = ['$', '45', '3j+5', 'Hello']\nprint(f'Original Data: {typ_data}')\n\n# Sorting the list\ntyp_data.sort()\n# Printing sorted list\nprint(f'Sorted Data: {typ_data}')\n\n----------\nOriginal Data: ['$', '45', '3j+5', 'Hello']\nSorted Data: ['$', '3j+5', '45', 'Hello']<\/pre><\/div>\n\n\n\n<p><strong>Example 2 &#8211; List containing the different data types<\/strong><\/p>\n\n\n\n<p>In the following example,&nbsp;<code>data<\/code>&nbsp;is a list that contains&nbsp;<strong>tuples<\/strong>&nbsp;and we sorted the&nbsp;<code>data<\/code>&nbsp;in descending order.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># List containing tuple data\ndata = [\n    ('Hey', 'There'),\n    ('Geeks', 'Welcome'),\n    ('To', 'GeekPython')\n]\n# Printing the type of list item\nprint(f'Type: {type(data[0])}')\n# Sorting the data in descending order\ndata.sort(reverse=True)\n# Printing modified data\nprint(data)\n\n----------\nType: &lt;class 'tuple'&gt;\nSorted Data: [('To', 'GeekPython'), ('Hey', 'There'), ('Geeks', 'Welcome')]<\/pre><\/div>\n\n\n\n<p><strong>What if we specify a similar name for the first values of the tuple?<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># List containing tuple data with first values having similar name\ndata = [\n    ('item', 2),\n    ('item', 1),\n    ('item', 3)\n]\n# Printing the type of list item\nprint(f'Type: {type(data[0])}')\n# Sorting the data in descending order\ndata.sort(reverse=True)\n# Printing modified data\nprint(f'Sorted Data: {data}')\n\n----------\nType: &lt;class 'tuple'&gt;\nSorted Data: [('item', 3), ('item', 2), ('item', 1)]<\/pre><\/div>\n\n\n\n<p>The tuples were sorted based on the second value because&nbsp;<code>sort()<\/code>&nbsp;cannot perform sorting on similar values, or more specifically, how can data be sorted in ascending or descending order if they are all similar?<\/p>\n\n\n\n<p><strong>Example 3 &#8211; Using a user-defined function<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># List containing dictionary data\ndata = [\n    {'fruit': 'strawberry', 'price': 100},\n    {'fruit': 'banana', 'price': 91},\n    {'fruit': 'mango', 'price': 132},\n    {'fruit': 'cherry', 'price': 82},\n]\n\nprint(f'Original Data: {data}')\n\n# Function for sorting by key 'price'\ndef sort_dict_by_price(item):\n    return item['price']\n\n# Sorting data using the user-defined sorting function\ndata.sort(key=sort_dict_by_price)\nprint('-'*20)\n# Printing the data\nprint(f'Sorted Data: {data}')<\/pre><\/div>\n\n\n\n<p>We&#8217;ve written a function called&nbsp;<code>sort_dict_by_price<\/code>&nbsp;that takes a parameter&nbsp;<code>item<\/code>, which is our dictionary itself, and returns the values of the key&nbsp;<code>'price'<\/code>.<\/p>\n\n\n\n<p>This function was passed to the&nbsp;<code>key<\/code>&nbsp;parameter, which will sort the&nbsp;<code>data<\/code>&nbsp;based on the&nbsp;<code>price<\/code>&nbsp;in ascending order.<\/p>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Original Data: [{'fruit': 'strawberry', 'price': 100}, {'fruit': 'banana', 'price': 91}, {'fruit': 'mango', 'price': 132}, {'fruit': 'cherry', 'price': 82}]\n--------------------\nSorted Data: [{'fruit': 'cherry', 'price': 82}, {'fruit': 'banana', 'price': 91}, {'fruit': 'strawberry', 'price': 100}, {'fruit': 'mango', 'price': 132}]<\/pre><\/div>\n\n\n\n<p><strong>Instead of explicitly defining the<\/strong>&nbsp;<code>sort_dict_by_price<\/code>&nbsp;<strong>function, we could have used the<\/strong>&nbsp;<code>lambda<\/code>&nbsp;<strong>function in the above code.<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># List containing dictionary data\ndata = [\n    {'fruit': 'strawberry', 'price': 100},\n    {'fruit': 'banana', 'price': 91},\n    {'fruit': 'mango', 'price': 132},\n    {'fruit': 'cherry', 'price': 82},\n]\n\nprint(f'Original Data: {data}')\n\n# Sorting data using the lambda function\ndata.sort(key=lambda item: item['fruit'])\nprint('-' * 20)\n# Printing the data\nprint(f'Sorted Data: {data}')<\/pre><\/div>\n\n\n\n<p>We changed the code above and passed the&nbsp;<code>lambda<\/code>&nbsp;function to the&nbsp;<code>key<\/code>. The expression&nbsp;<code>lambda item: item['fruit']<\/code>&nbsp;is equivalent to the previous code&#8217;s&nbsp;<code>sort_dict_by_price<\/code>&nbsp;function.<\/p>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Original Data: [{'fruit': 'strawberry', 'price': 100}, {'fruit': 'banana', 'price': 91}, {'fruit': 'mango', 'price': 132}, {'fruit': 'cherry', 'price': 82}]\n--------------------\nSorted Data: [{'fruit': 'banana', 'price': 91}, {'fruit': 'cherry', 'price': 82}, {'fruit': 'mango', 'price': 132}, {'fruit': 'strawberry', 'price': 100}]<\/pre><\/div>\n\n\n\n<p><strong>Example 4 &#8211; Sorting tuple data by specifying sorting criteria<\/strong><\/p>\n\n\n\n<p>In the following example,&nbsp;<code>data<\/code>&nbsp;is a list containing tuples and we sorted the&nbsp;<code>data<\/code>&nbsp;in descending order based on the first items of the tuple.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># List containing tuple data\ndata = [\n    ('strawberry', 100),\n    ('banana', 91),\n    ('mango', 132),\n    ('cherry', 82),\n]\n\nprint(f'Original Data: {data}')\n\n# Sorting data based on first value in descending order\ndata.sort(key=lambda item: item[0], reverse=True)\nprint('-' * 20)\n# Printing the data\nprint(f'Sorted Data: {data}')<\/pre><\/div>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Original Data: [('strawberry', 100), ('banana', 91), ('mango', 132), ('cherry', 82)]\n--------------------\nSorted Data: [('strawberry', 100), ('mango', 132), ('cherry', 82), ('banana', 91)]<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-sorted\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-sorted\"><\/a>sorted()<\/h2>\n\n\n\n<p>Python&nbsp;<code>sorted()<\/code>&nbsp;function is used to&nbsp;<strong>sort the iterable data<\/strong>. By default, this function&nbsp;<strong>sorts the data in ascending order<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># Tuple data\ntuple_data = ((4, 's'), (1, 'q'), (3, 'z'), (4, 'a'))\nprint(f'Original: {tuple_data}')\n# Using sorted function\nsorting = sorted(tuple_data)\nprint('-'*20)\n# Printing the sorted data\nprint(f'Sorted: {sorting}')<\/pre><\/div>\n\n\n\n<p>We have nested tuple data stored in the variable&nbsp;<code>tuple_data<\/code>, used the&nbsp;<code>sorted()<\/code>&nbsp;function with our&nbsp;<strong>iterable<\/strong>&nbsp;as a parameter, and then printed the sorted data.<\/p>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Original: ((4, 's'), (1, 'q'), (3, 'z'), (4, 'a'))\n--------------------\nSorted: [(1, 'q'), (3, 'z'), (4, 'a'), (4, 's')]<\/pre><\/div>\n\n\n\n<p>The data were sorted based on the&nbsp;<strong>first item<\/strong>&nbsp;of the tuple&nbsp;<code>tuple_data<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-syntax-1\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-syntax-1\"><\/a>Syntax<\/h3>\n\n\n\n<p><code>sorted(iterable, key=None, reverse=False)<\/code><\/p>\n\n\n\n<p>Here<\/p>\n\n\n\n<p><code>iterable<\/code>&nbsp;&#8211; Required. Any iterable data<\/p>\n\n\n\n<p><code>key<\/code>&nbsp;&#8211; defaults to&nbsp;<code>None<\/code>. To specify the sorting criteria.<\/p>\n\n\n\n<p><code>reverse<\/code>&nbsp;&#8211; Defaults to&nbsp;<code>False<\/code>. When set to&nbsp;<code>True<\/code>, the data will be sorted in descending order.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"heading-examples-1\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-examples-1\"><\/a>Examples<\/h3>\n\n\n\n<p>We have data of various data types that are all iterable; we&#8217;ll sort them using the&nbsp;<code>sorted()<\/code>&nbsp;function.<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">list_data = [43, 21, 2, 34]\nprint(f'Sorted List: {sorted(list_data)}')\n\n# Seperator\nprint('-'*20)\n\ntuple_data = (('x', 3), ('w', 1), ('1', 4))\nprint(f'Sorted Tuple: {sorted(tuple_data)}')\n\n# Seperator\nprint('-'*20)\n\ndict_data = {9: 'G', 1: 'V', 4: 'E'}\nprint(f'Sorted Dictionary Keys: {sorted(dict_data)}')\nprint(f'Sorted Dictionary Values: {sorted(dict_data.values())}')\nprint(f'Sorted Dictionary Items: {sorted(dict_data.items())}')<\/pre><\/div>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Sorted List: [2, 21, 34, 43]\n--------------------\nSorted Tuple: [('1', 4), ('w', 1), ('x', 3)]\n--------------------\nSorted Dictionary Keys: [1, 4, 9]\nSorted Dictionary Values: ['E', 'G', 'V']\nSorted Dictionary Items: [(1, 'V'), (4, 'E'), (9, 'G')]<\/pre><\/div>\n\n\n\n<p><strong>Example 2 &#8211; Using<\/strong>&nbsp;<code>key<\/code>&nbsp;<strong>and<\/strong>&nbsp;<code>reverse<\/code>&nbsp;<strong>parameters<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \"># Tuple data\ntuple_data = (\n    ('Mango', 25),\n    ('Walnut', 65),\n    ('Cherry', 10),\n    ('Apple', 68),\n)\n\nprint(f'Original: {tuple_data}')\n# Separator\nprint('-'*20)\n\n# Function for grabbing 2nd item from the data\ndef sorting_tup_data(item):\n    return item[1]\n\n# Sorting based on sorting criteria in descending order\nsorting = sorted(tuple_data, key=sorting_tup_data, reverse=True)\nprint(f'Sorted: {sorting}')<\/pre><\/div>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:python decode:true \">Original: (('Mango', 25), ('Walnut', 65), ('Cherry', 10), ('Apple', 68))\n--------------------\nSorted: [('Apple', 68), ('Walnut', 65), ('Mango', 25), ('Cherry', 10)]<\/pre><\/div>\n\n\n\n<p>Due to the use of the&nbsp;<code>key<\/code>&nbsp;parameter where we passed the custom function, the tuple was sorted based on the&nbsp;<strong>second item<\/strong>&nbsp;and data was sorted in descending order because the&nbsp;<code>reverse<\/code>&nbsp;was set to&nbsp;<code>True<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-difference\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-difference\"><\/a>Difference<\/h2>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><td>sort()<\/td><td>sorted()<\/td><\/tr><\/thead><tbody><tr><td>Used to sort the Python&nbsp;<strong>List<\/strong>.<\/td><td>Used to sort any iterable data such as&nbsp;<strong>List<\/strong>,&nbsp;<strong>Tuple<\/strong>,&nbsp;<strong>Dictionary,<\/strong>&nbsp;and more.<\/td><\/tr><tr><td>Takes two parameters:&nbsp;<code>key<\/code>&nbsp;and&nbsp;<code>reverse<\/code>.<\/td><td>Takes three parameters:&nbsp;<code>iterable<\/code>,&nbsp;<code>key<\/code>&nbsp;and&nbsp;<code>reverse<\/code>.<\/td><\/tr><tr><td>It is a&nbsp;<code>List<\/code>&nbsp;function(<code>list.sort()<\/code>) and can only work with Lists.<\/td><td>It is a function to sort any data which can be iterated.<\/td><\/tr><tr><td><code>sort()<\/code>&nbsp;modifies the original list.<\/td><td><code>sorted()<\/code>&nbsp;doesn&#8217;t modify the original data instead it returns the new modified data.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"heading-conclusion\"><a href=\"https:\/\/geekpython.in\/python-sort-vs-sorted#heading-conclusion\"><\/a>Conclusion<\/h2>\n\n\n\n<p>We&#8217;ve seen a comparison of the list&nbsp;<code>sort()<\/code>&nbsp;and&nbsp;<code>sorted()<\/code>&nbsp;functions. We&#8217;ve coded the examples to understand how these functions work. Both functions are used to sort data, but the&nbsp;<code>sort()<\/code>&nbsp;function only&nbsp;<strong>sorts Python lists<\/strong>, whereas the&nbsp;<code>sorted()<\/code>&nbsp;function&nbsp;<strong>sorts iterable data<\/strong>.<\/p>\n\n\n\n<p>We&#8217;ve also seen the differences between the two in a table format.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\ud83c\udfc6<strong>Other articles you might be interested in if you liked this one<\/strong><\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/reverse-vs-reversed-in-python\" rel=\"noreferrer noopener\">Comparing the list reverse and reversed functions<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/different-ways-to-reverse-a-python-list\" rel=\"noreferrer noopener\">8 different ways to reverse a Python list<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/argmax-function-in-numpy-and-tensorflow\" rel=\"noreferrer noopener\">NumPy argmax() and TensorFlow argmax() &#8211; Are they similar<\/a>?<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/exec-function-in-python\" rel=\"noreferrer noopener\">Execute your code dynamically using the exec() in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/shutil-module-in-python\" rel=\"noreferrer noopener\">Perform high-level file operations on files in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/python-enumerate-function-with-example-beginners-guide\" rel=\"noreferrer noopener\">Number your iterable data using the enumerate() in Python<\/a>.<\/p>\n\n\n\n<p>\u2705<a target=\"_blank\" href=\"https:\/\/geekpython.in\/understanding-args-and-kwargs-in-python-best-practices-and-guide\" rel=\"noreferrer noopener\">Understanding args and kwargs in function parameter in Python<\/a>.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>That&#8217;s all for now<\/strong><\/p>\n\n\n\n<p><strong>Keep Coding\u270c\u270c<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ll compare the Python&#8217;s list&nbsp;sort()&nbsp;and&nbsp;sorted()&nbsp;functions in this article. We&#8217;ll learn about these functions, such as what they are and how they differ programmatically and syntactically. Python&nbsp;sort()&nbsp;and&nbsp;sorted()&nbsp;are used to sort the data in ascending or descending order. Their goals are the same but are used in different conditions. sort() The&nbsp;sort()&nbsp;function is connected to the Python list [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1058,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[2,41],"tags":[40,12,31],"class_list":["post-1056","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-function","tag-functions","tag-python","tag-python3","entry","has-media"],"_links":{"self":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/comments?post=1056"}],"version-history":[{"count":3,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1056\/revisions"}],"predecessor-version":[{"id":1300,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/posts\/1056\/revisions\/1300"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media\/1058"}],"wp:attachment":[{"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/media?parent=1056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/categories?post=1056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekpython.in\/wp-json\/wp\/v2\/tags?post=1056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}