{"id":22400,"date":"2020-12-17T13:04:22","date_gmt":"2020-12-17T21:04:22","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=22400"},"modified":"2023-12-01T04:06:13","modified_gmt":"2023-12-01T12:06:13","slug":"python-return-multiple-values","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/","title":{"rendered":"Python: Return Multiple Values from a Function"},"content":{"rendered":"\n<p><em>You can return multiple values by bundling those values into a dictionary, tuple, or a list. These data types let you store multiple similar values. You can extract individual values from them in your main program. Or, you can pass multiple values and separate them with commas.<\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/careerkarma.com\/blog\/python-functions\/\">Python functions<\/a> can return multiple values. To return multiple values, you can return either a dictionary, a Python tuple, or a list to your main program.<\/p>\n\n\n\n<p>This guide discusses how to return multiple values to a main program using these two methods. Let&#8217;s begin.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python: Return Multiple Values<\/h2>\n\n\n\n<p>You can return multiple values from a Python function using:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>A list that contains multiple values.<\/li><li>A tuple with multiple values.<\/li><li>A dictionary with multiple records.<\/li><li>Multiple values separated by commas.<\/li><\/ul>\n\n\n\n<p>All the above data types let you store multiple values. The solution of returning multiple values separated by commas is the most elegant. This is because this approach makes your intent clear: to return multiple separate values back to your main program.<\/p>\n\n\n\n<p>A <a href=\"https:\/\/careerkarma.com\/blog\/python-return\/\">Python return statement<\/a> sends values from a function to a main program. This statement is most commonly used to return one value to a main program. It can be used to return multiple values to a main program.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python: Return Multiple Values with Commas<\/h2>\n\n\n\n<p>You can return multiple values by separating the values you want to return with commas. These values should appear after your Python return statement.<\/p>\n\n\n\n<p>We\u2019re going to write a program that calculates the number of sales made at an electronics store. We&#8217;re only going to count sales worth more than $500. Our program will also calculate the average value of each sale.<\/p>\n\n\n\n<p>To start, let\u2019s define a <a href=\"https:\/\/careerkarma.com\/blog\/python-array\/\">Python array<\/a> that contains a list of sales:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>sales = [59.99, 240.00, 655.25, 75.99]<\/pre><\/div>\n\n\n\n<p>Next, write a <a href=\"https:\/\/careerkarma.com\/blog\/python-functions\/\">Python function<\/a> that calculates the number of sales worth more than $500 and the average value of a purchase:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>def calculate_data(sales):\n\t    over_limit = 0\n\n\t    for s in sales:\n\t\t         if s &gt; 500:\n\t\t\t             over_limit += 1\n\n\t    average_purchase = sum(sales) \/ len(sales)\n\n\t    return over_limit, average_purchase<\/pre><\/div>\n\n\n\n<p>Our function iterates over every sale in our list using a for loop. If a sale is worth more than $500, our \u201cover_limit\u201d <a href=\"https:\/\/careerkarma.com\/blog\/python-variables\/\">Python variable<\/a> is incremented by one. We then calculate the average value of a purchase by dividing the total value of all sales by the number of sales made.<\/p>\n\n\n\n<p>At the end of our function, use a return statement to return the values of \u201cover_limit\u201d and \u201caverage_purchase\u201d to our main program.<\/p>\n\n\n\n<p>All that\u2019s left to do is call our function and display the data our program calculates to the console:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>over_limit, average_purchase = calculate_data(sales)\nprint(&quot;{} sales were made over $500. The average purchase was ${}.&quot;.format(over_limit, round(average_purchase)))<\/pre><\/div>\n\n\n\n<p>We round the average purchase to two decimal places using the <em>round()<\/em> method. Our code prints out a message informing us of the values we have calculated. Let\u2019s run our program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>1 sales were made over $500. The average purchase was $258.<\/pre><\/div>\n\n\n\n<p>Our program successfully tells us how many sales were made worth more than $500 and what the average price of a purchase was.<\/p>\n\n\n\n<p>This code works because the \u201creturn\u201d statement turns our values into a tuple and <a href=\"https:\/\/careerkarma.com\/blog\/python-tuples\/\">returns a tuple list<\/a> to our main program. We then unpack this tuple into two variables on this line of code:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>over_limit, average_purchase = calculate_data(sales)<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Python: Return Multiple Values with a List or Tuple<\/h2>\n\n\n\n<p>Both lists and tuples let you store multiple values. This means we can use them to return multiple values to our main program.<\/p>\n\n\n\n<p>Using a list or a tuple is best if the values you are returning have some kind of relationship. But, you can use this approach to return any collection of values.<\/p>\n\n\n\n<p>We&#8217;re going to return the average purchase size and the number of purchases worth over $500 to our main program. To do so, let&#8217;s refer back to our example from earlier and make a small change to use a list:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>def calculate_data(sales):\n\tover_limit = 0\n\tfor s in sales:\n\t\tif s &gt; 500:\n\t\tover_limit += 1\n\t\taverage_purchase = sum(sales) \/ len(sales)\n\n\treturn [over_limit, average_purchase]<\/pre><\/div>\n\n\n\n<p>We have just separated our values into a single list. Our list contains the number of purchases worth over $500 and the value of an average purchase, respectively.<\/p>\n\n\n\n<p>We could also return a tuple data structure. To do so, we would replace our square brackets with curly brackets. The big factor to consider is that tuples cannot contain duplicate values. If there is a chance two values you pass to your main program will be equal, avoid using a tuple.<\/p>\n\n\n\n<p>To access these values in our main program, we have to use indexing:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>values = calculate_data(sales)\n\nprint(&quot;{} sales were made over $500. The average purchase was ${}.&quot;.format(values[0], round(values[1])))<\/pre><\/div>\n\n\n\n<p>We use the values[0] syntax to access the first value in the list our calculate_data() function returns. This corresponds to the value of &#8220;over_limit&#8221; in our function. We use the values[1] syntax to access the value of the average purchase.<\/p>\n\n\n\n<p>Our code returns:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>1 sales were made over $500. The average purchase was $258.<\/pre><\/div>\n\n\n\n<p>Our code works just like our last example, but this time we&#8217;ve used a list to separate the values in our code.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Python: Return Multiple Values with a Dictionary<\/h2>\n\n\n\n<p>We can return multiple values from a function using a dictionary.<\/p>\n\n\n\n<p>In our last example, we only returned two values to our main program. This made it convenient to use unpacking syntax (where you <a href=\"https:\/\/careerkarma.com\/blog\/python-valueerror-too-many-values-to-unpack-expected-2\/\">\u201cunpack\u201d values into multiple variables<\/a>).<\/p>\n\n\n\n<p>If we were working with more values, it may be easier to return a dictionary that associates each value with a label. Let\u2019s revise our last function to use a dictionary to return multiple values to our main program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>def calculate_data(sales):\n\t    over_limit = 0\n\n\t    for s in sales:\n\t\t         if s &gt; 500:\n\t\t\t             over_limit += 1\n\n\t    average_purchase = sum(sales) \/ len(sales)\n\n\t    return { &quot;limit&quot;: over_limit, &quot;average&quot;: average_purchase }<\/pre><\/div>\n\n\n\n<p>Our function returns a dictionary with two keys and values. The keys, \u201climit\u201d and \u201caverage\u201d, can be used to uniquely identify each value. Now we have to revise our function call and our print statement to support this new syntax:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>values = calculate_data(sales)\nprint(&quot;{} sales were made over $500. The average purchase was ${}.&quot;.format(values[&quot;limit&quot;], round(values[&quot;average&quot;])))<\/pre><\/div>\n\n\n\n<p>We return a dictionary back to our main program. We assign this dictionary to the variable \u201cvalues\u201d. Then, we use indexing to retrieve the values of \u201climit\u201d and \u201caverage\u201d.<\/p>\n\n\n\n<p>Let\u2019s run our program:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>1 sales were made over $500. The average purchase was $258.<\/pre><\/div>\n\n\n\n<p>Our program returns the same response as earlier. This is expected because all we have done is changed the way in which we return values to our main program. Our calculation logic remains the same.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>You can return multiple values from a function using either a dictionary, a tuple, or a list. These data types all let you store multiple values. There is no specific syntax for returning multiple values, but these methods act as a good substitute.<\/p>\n\n\n\n<p>The comma-separated method is more concise and easier to understand if you are working with a small set of values. Say you are returning a larger range of values from a function. You may want to use a dictionary to send multiple values back to the main program.<\/p>\n\n\n\n<p>Do you want to accelerate your journey learning the Python programming language? Check out our <a href=\"https:\/\/careerkarma.com\/blog\/how-to-learn-python\/\">How to Learn Python guide<\/a> for advice on top Python courses and online learning resources.<\/p>\n","protected":false},"excerpt":{"rendered":"You can return multiple values by bundling those values into a dictionary, tuple, or a list. These data types let you store multiple similar values. You can extract individual values from them in your main program. Or, you can pass multiple values and separate them with commas. Python functions can return multiple values. To return&hellip;","protected":false},"author":240,"featured_media":8517,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-22400","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: Return Multiple Values from a Function | Career Karma<\/title>\n<meta name=\"description\" content=\"On Career Karma, learn how to return multiple values from a Python function using the comma-separated values approach and a dictionary.\" \/>\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-return-multiple-values\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python: Return Multiple Values from a Function\" \/>\n<meta property=\"og:description\" content=\"On Career Karma, learn how to return multiple values from a Python function using the comma-separated values approach and a dictionary.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/\" \/>\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-12-17T21:04:22+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T12:06:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"667\" \/>\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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Python: Return Multiple Values from a Function\",\"datePublished\":\"2020-12-17T21:04:22+00:00\",\"dateModified\":\"2023-12-01T12:06:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/\"},\"wordCount\":1085,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/\",\"name\":\"Python: Return Multiple Values from a Function | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg\",\"datePublished\":\"2020-12-17T21:04:22+00:00\",\"dateModified\":\"2023-12-01T12:06:13+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"On Career Karma, learn how to return multiple values from a Python function using the comma-separated values approach and a dictionary.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg\",\"width\":1000,\"height\":667},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#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: Return Multiple Values from a Function\"}]},{\"@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: Return Multiple Values from a Function | Career Karma","description":"On Career Karma, learn how to return multiple values from a Python function using the comma-separated values approach and a dictionary.","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-return-multiple-values\/","og_locale":"en_US","og_type":"article","og_title":"Python: Return Multiple Values from a Function","og_description":"On Career Karma, learn how to return multiple values from a Python function using the comma-separated values approach and a dictionary.","og_url":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-12-17T21:04:22+00:00","article_modified_time":"2023-12-01T12:06:13+00:00","og_image":[{"width":1000,"height":667,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Python: Return Multiple Values from a Function","datePublished":"2020-12-17T21:04:22+00:00","dateModified":"2023-12-01T12:06:13+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/"},"wordCount":1085,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/","url":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/","name":"Python: Return Multiple Values from a Function | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg","datePublished":"2020-12-17T21:04:22+00:00","dateModified":"2023-12-01T12:06:13+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"On Career Karma, learn how to return multiple values from a Python function using the comma-separated values approach and a dictionary.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2019\/11\/danial-ricaros-FCHlYvR5gJI-unsplash.jpg","width":1000,"height":667},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-return-multiple-values\/#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: Return Multiple Values from a Function"}]},{"@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\/22400","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=22400"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/22400\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/8517"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=22400"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=22400"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=22400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}