[{"data":1,"prerenderedAt":2186},["ShallowReactive",2],{"doc-\u002Fhow-to\u002Fhow-to-return-multiple-values-from-a-function-in-python":3},{"id":4,"title":5,"body":6,"description":2179,"extension":2180,"meta":2181,"navigation":82,"path":2182,"seo":2183,"stem":2184,"__hash__":2185},"content\u002Fhow-to\u002Fhow-to-return-multiple-values-from-a-function-in-python.md","How to Return Multiple Values from a Function in Python",{"type":7,"value":8,"toc":2150},"minimark",[9,13,17,20,25,138,141,156,159,163,166,182,191,195,202,271,273,312,319,322,333,336,388,390,409,417,421,424,492,494,506,509,586,588,600,603,608,611,614,681,684,722,728,731,735,738,817,819,834,837,865,868,875,879,882,886,889,952,954,975,978,982,985,1140,1142,1160,1163,1174,1177,1256,1380,1383,1387,1390,1394,1445,1452,1456,1504,1510,1528,1531,1571,1576,1579,1593,1597,1600,1658,1661,1686,1689,1692,1785,1787,1801,1805,1808,1856,1859,1863,1866,1883,1886,1957,1960,2027,2036,2040,2043,2061,2068,2072,2076,2079,2083,2086,2090,2093,2097,2100,2104,2107,2111,2146],[10,11,5],"h1",{"id":12},"how-to-return-multiple-values-from-a-function-in-python",[14,15,16],"p",{},"If you want one Python function to give back more than one result, the most common solution is simple: return the values separated by commas.",[14,18,19],{},"In practice, Python usually packs those values into a tuple. You can then unpack that tuple into separate variables.",[21,22,24],"h2",{"id":23},"quick-answer","Quick answer",[26,27,32],"pre",{"className":28,"code":29,"language":30,"meta":31,"style":31},"language-python shiki shiki-themes material-theme-lighter github-light github-dark","def get_name_and_age():\n    return \"Alice\", 25\n\nname, age = get_name_and_age()\n\nprint(name)\nprint(age)\n","python","",[33,34,35,52,77,84,106,111,126],"code",{"__ignoreMap":31},[36,37,40,44,48],"span",{"class":38,"line":39},"line",1,[36,41,43],{"class":42},"sbsja","def",[36,45,47],{"class":46},"sGLFI"," get_name_and_age",[36,49,51],{"class":50},"sP7_E","():\n",[36,53,55,59,63,67,70,73],{"class":38,"line":54},2,[36,56,58],{"class":57},"sVHd0","    return",[36,60,62],{"class":61},"sjJ54"," \"",[36,64,66],{"class":65},"s_sjI","Alice",[36,68,69],{"class":61},"\"",[36,71,72],{"class":50},",",[36,74,76],{"class":75},"srdBf"," 25\n",[36,78,80],{"class":38,"line":79},3,[36,81,83],{"emptyLinePlaceholder":82},true,"\n",[36,85,87,91,93,96,100,103],{"class":38,"line":86},4,[36,88,90],{"class":89},"su5hD","name",[36,92,72],{"class":50},[36,94,95],{"class":89}," age ",[36,97,99],{"class":98},"smGrS","=",[36,101,47],{"class":102},"slqww",[36,104,105],{"class":50},"()\n",[36,107,109],{"class":38,"line":108},5,[36,110,83],{"emptyLinePlaceholder":82},[36,112,114,118,121,123],{"class":38,"line":113},6,[36,115,117],{"class":116},"sptTA","print",[36,119,120],{"class":50},"(",[36,122,90],{"class":102},[36,124,125],{"class":50},")\n",[36,127,129,131,133,136],{"class":38,"line":128},7,[36,130,117],{"class":116},[36,132,120],{"class":50},[36,134,135],{"class":102},"age",[36,137,125],{"class":50},[14,139,140],{},"Output:",[26,142,144],{"className":28,"code":143,"language":30,"meta":31,"style":31},"Alice\n25\n",[33,145,146,151],{"__ignoreMap":31},[36,147,148],{"class":38,"line":39},[36,149,150],{"class":89},"Alice\n",[36,152,153],{"class":38,"line":54},[36,154,155],{"class":75},"25\n",[14,157,158],{},"In Python, returning multiple values usually means returning a tuple. You can unpack the result into separate variables.",[21,160,162],{"id":161},"what-this-page-helps-you-do","What this page helps you do",[14,164,165],{},"This page shows you how to:",[167,168,169,173,176,179],"ul",{},[170,171,172],"li",{},"Return two or more values from one function",[170,174,175],{},"Store the returned values in separate variables",[170,177,178],{},"Understand that Python usually returns a tuple",[170,180,181],{},"Choose between a tuple, list, or dictionary based on clarity",[14,183,184,185,190],{},"If you are new to functions, see ",[186,187,189],"a",{"href":188},"\u002Flearn\u002Fpython-functions-explained","Python functions explained"," first.",[21,192,194],{"id":193},"the-simplest-way-return-values-separated-by-commas","The simplest way: return values separated by commas",[14,196,197,198,201],{},"The easiest way to return multiple values is to put them after ",[33,199,200],{},"return",", separated by commas.",[26,203,205],{"className":28,"code":204,"language":30,"meta":31,"style":31},"def get_coordinates():\n    return 10, 20\n\nresult = get_coordinates()\nprint(result)\nprint(type(result))\n",[33,206,207,216,228,232,243,254],{"__ignoreMap":31},[36,208,209,211,214],{"class":38,"line":39},[36,210,43],{"class":42},[36,212,213],{"class":46}," get_coordinates",[36,215,51],{"class":50},[36,217,218,220,223,225],{"class":38,"line":54},[36,219,58],{"class":57},[36,221,222],{"class":75}," 10",[36,224,72],{"class":50},[36,226,227],{"class":75}," 20\n",[36,229,230],{"class":38,"line":79},[36,231,83],{"emptyLinePlaceholder":82},[36,233,234,237,239,241],{"class":38,"line":86},[36,235,236],{"class":89},"result ",[36,238,99],{"class":98},[36,240,213],{"class":102},[36,242,105],{"class":50},[36,244,245,247,249,252],{"class":38,"line":108},[36,246,117],{"class":116},[36,248,120],{"class":50},[36,250,251],{"class":102},"result",[36,253,125],{"class":50},[36,255,256,258,260,264,266,268],{"class":38,"line":113},[36,257,117],{"class":116},[36,259,120],{"class":50},[36,261,263],{"class":262},"sZMiF","type",[36,265,120],{"class":50},[36,267,251],{"class":102},[36,269,270],{"class":50},"))\n",[14,272,140],{},[26,274,276],{"className":28,"code":275,"language":30,"meta":31,"style":31},"(10, 20)\n\u003Cclass 'tuple'>\n",[33,277,278,292],{"__ignoreMap":31},[36,279,280,282,285,287,290],{"class":38,"line":39},[36,281,120],{"class":50},[36,283,284],{"class":75},"10",[36,286,72],{"class":50},[36,288,289],{"class":75}," 20",[36,291,125],{"class":50},[36,293,294,297,300,303,306,309],{"class":38,"line":54},[36,295,296],{"class":98},"\u003C",[36,298,299],{"class":42},"class",[36,301,302],{"class":61}," '",[36,304,305],{"class":65},"tuple",[36,307,308],{"class":61},"'",[36,310,311],{"class":98},">\n",[14,313,314,315,318],{},"Even though you wrote ",[33,316,317],{},"return 10, 20",", Python created one tuple containing both values.",[14,320,321],{},"This works well when:",[167,323,324,327,330],{},[170,325,326],{},"You have a small number of returned values",[170,328,329],{},"The meaning of each value is clear",[170,331,332],{},"The order is easy to remember",[14,334,335],{},"Here is another example:",[26,337,339],{"className":28,"code":338,"language":30,"meta":31,"style":31},"def get_min_and_max():\n    return 3, 9\n\nvalues = get_min_and_max()\nprint(values)\n",[33,340,341,350,362,366,377],{"__ignoreMap":31},[36,342,343,345,348],{"class":38,"line":39},[36,344,43],{"class":42},[36,346,347],{"class":46}," get_min_and_max",[36,349,51],{"class":50},[36,351,352,354,357,359],{"class":38,"line":54},[36,353,58],{"class":57},[36,355,356],{"class":75}," 3",[36,358,72],{"class":50},[36,360,361],{"class":75}," 9\n",[36,363,364],{"class":38,"line":79},[36,365,83],{"emptyLinePlaceholder":82},[36,367,368,371,373,375],{"class":38,"line":86},[36,369,370],{"class":89},"values ",[36,372,99],{"class":98},[36,374,347],{"class":102},[36,376,105],{"class":50},[36,378,379,381,383,386],{"class":38,"line":108},[36,380,117],{"class":116},[36,382,120],{"class":50},[36,384,385],{"class":102},"values",[36,387,125],{"class":50},[14,389,140],{},[26,391,393],{"className":28,"code":392,"language":30,"meta":31,"style":31},"(3, 9)\n",[33,394,395],{"__ignoreMap":31},[36,396,397,399,402,404,407],{"class":38,"line":39},[36,398,120],{"class":50},[36,400,401],{"class":75},"3",[36,403,72],{"class":50},[36,405,406],{"class":75}," 9",[36,408,125],{"class":50},[14,410,411,412,416],{},"If you want to understand function return values more clearly, read ",[186,413,415],{"href":414},"\u002Flearn\u002Freturn-values-in-python-functions","return values in Python functions",".",[21,418,420],{"id":419},"how-to-unpack-the-returned-values","How to unpack the returned values",[14,422,423],{},"Unpacking means storing each returned item in its own variable.",[26,425,426],{"className":28,"code":29,"language":30,"meta":31,"style":31},[33,427,428,436,450,454,468,472,482],{"__ignoreMap":31},[36,429,430,432,434],{"class":38,"line":39},[36,431,43],{"class":42},[36,433,47],{"class":46},[36,435,51],{"class":50},[36,437,438,440,442,444,446,448],{"class":38,"line":54},[36,439,58],{"class":57},[36,441,62],{"class":61},[36,443,66],{"class":65},[36,445,69],{"class":61},[36,447,72],{"class":50},[36,449,76],{"class":75},[36,451,452],{"class":38,"line":79},[36,453,83],{"emptyLinePlaceholder":82},[36,455,456,458,460,462,464,466],{"class":38,"line":86},[36,457,90],{"class":89},[36,459,72],{"class":50},[36,461,95],{"class":89},[36,463,99],{"class":98},[36,465,47],{"class":102},[36,467,105],{"class":50},[36,469,470],{"class":38,"line":108},[36,471,83],{"emptyLinePlaceholder":82},[36,473,474,476,478,480],{"class":38,"line":113},[36,475,117],{"class":116},[36,477,120],{"class":50},[36,479,90],{"class":102},[36,481,125],{"class":50},[36,483,484,486,488,490],{"class":38,"line":128},[36,485,117],{"class":116},[36,487,120],{"class":50},[36,489,135],{"class":102},[36,491,125],{"class":50},[14,493,140],{},[26,495,496],{"className":28,"code":143,"language":30,"meta":31,"style":31},[33,497,498,502],{"__ignoreMap":31},[36,499,500],{"class":38,"line":39},[36,501,150],{"class":89},[36,503,504],{"class":38,"line":54},[36,505,155],{"class":75},[14,507,508],{},"This is often easier to read than using a single variable:",[26,510,512],{"className":28,"code":511,"language":30,"meta":31,"style":31},"def get_name_and_age():\n    return \"Alice\", 25\n\nresult = get_name_and_age()\n\nprint(result[0])\nprint(result[1])\n",[33,513,514,522,536,540,550,554,571],{"__ignoreMap":31},[36,515,516,518,520],{"class":38,"line":39},[36,517,43],{"class":42},[36,519,47],{"class":46},[36,521,51],{"class":50},[36,523,524,526,528,530,532,534],{"class":38,"line":54},[36,525,58],{"class":57},[36,527,62],{"class":61},[36,529,66],{"class":65},[36,531,69],{"class":61},[36,533,72],{"class":50},[36,535,76],{"class":75},[36,537,538],{"class":38,"line":79},[36,539,83],{"emptyLinePlaceholder":82},[36,541,542,544,546,548],{"class":38,"line":86},[36,543,236],{"class":89},[36,545,99],{"class":98},[36,547,47],{"class":102},[36,549,105],{"class":50},[36,551,552],{"class":38,"line":108},[36,553,83],{"emptyLinePlaceholder":82},[36,555,556,558,560,562,565,568],{"class":38,"line":113},[36,557,117],{"class":116},[36,559,120],{"class":50},[36,561,251],{"class":102},[36,563,564],{"class":50},"[",[36,566,567],{"class":75},"0",[36,569,570],{"class":50},"])\n",[36,572,573,575,577,579,581,584],{"class":38,"line":128},[36,574,117],{"class":116},[36,576,120],{"class":50},[36,578,251],{"class":102},[36,580,564],{"class":50},[36,582,583],{"class":75},"1",[36,585,570],{"class":50},[14,587,140],{},[26,589,590],{"className":28,"code":143,"language":30,"meta":31,"style":31},[33,591,592,596],{"__ignoreMap":31},[36,593,594],{"class":38,"line":39},[36,595,150],{"class":89},[36,597,598],{"class":38,"line":54},[36,599,155],{"class":75},[14,601,602],{},"Unpacking is usually better for beginners because the variable names make the result clearer.",[604,605,607],"h3",{"id":606},"important-rule","Important rule",[14,609,610],{},"The number of variables must match the number of returned values.",[14,612,613],{},"This works:",[26,615,617],{"className":28,"code":616,"language":30,"meta":31,"style":31},"def get_dimensions():\n    return 1920, 1080\n\nwidth, height = get_dimensions()\nprint(width)\nprint(height)\n",[33,618,619,628,640,644,660,670],{"__ignoreMap":31},[36,620,621,623,626],{"class":38,"line":39},[36,622,43],{"class":42},[36,624,625],{"class":46}," get_dimensions",[36,627,51],{"class":50},[36,629,630,632,635,637],{"class":38,"line":54},[36,631,58],{"class":57},[36,633,634],{"class":75}," 1920",[36,636,72],{"class":50},[36,638,639],{"class":75}," 1080\n",[36,641,642],{"class":38,"line":79},[36,643,83],{"emptyLinePlaceholder":82},[36,645,646,649,651,654,656,658],{"class":38,"line":86},[36,647,648],{"class":89},"width",[36,650,72],{"class":50},[36,652,653],{"class":89}," height ",[36,655,99],{"class":98},[36,657,625],{"class":102},[36,659,105],{"class":50},[36,661,662,664,666,668],{"class":38,"line":108},[36,663,117],{"class":116},[36,665,120],{"class":50},[36,667,648],{"class":102},[36,669,125],{"class":50},[36,671,672,674,676,679],{"class":38,"line":113},[36,673,117],{"class":116},[36,675,120],{"class":50},[36,677,678],{"class":102},"height",[36,680,125],{"class":50},[14,682,683],{},"This does not work:",[26,685,687],{"className":28,"code":686,"language":30,"meta":31,"style":31},"def get_dimensions():\n    return 1920, 1080\n\nwidth = get_dimensions()\n",[33,688,689,697,707,711],{"__ignoreMap":31},[36,690,691,693,695],{"class":38,"line":39},[36,692,43],{"class":42},[36,694,625],{"class":46},[36,696,51],{"class":50},[36,698,699,701,703,705],{"class":38,"line":54},[36,700,58],{"class":57},[36,702,634],{"class":75},[36,704,72],{"class":50},[36,706,639],{"class":75},[36,708,709],{"class":38,"line":79},[36,710,83],{"emptyLinePlaceholder":82},[36,712,713,716,718,720],{"class":38,"line":86},[36,714,715],{"class":89},"width ",[36,717,99],{"class":98},[36,719,625],{"class":102},[36,721,105],{"class":50},[14,723,724,725,727],{},"The code above is valid Python, but ",[33,726,648],{}," will contain the whole tuple, not just the first value.",[14,729,730],{},"If you actually want separate values, you must unpack them.",[21,732,734],{"id":733},"returning-a-tuple-explicitly","Returning a tuple explicitly",[14,736,737],{},"You can also write the tuple with parentheses.",[26,739,741],{"className":28,"code":740,"language":30,"meta":31,"style":31},"def get_status():\n    return (\"success\", 200)\n\nmessage, code = get_status()\n\nprint(message)\nprint(code)\n",[33,742,743,752,773,777,793,797,807],{"__ignoreMap":31},[36,744,745,747,750],{"class":38,"line":39},[36,746,43],{"class":42},[36,748,749],{"class":46}," get_status",[36,751,51],{"class":50},[36,753,754,756,759,761,764,766,768,771],{"class":38,"line":54},[36,755,58],{"class":57},[36,757,758],{"class":50}," (",[36,760,69],{"class":61},[36,762,763],{"class":65},"success",[36,765,69],{"class":61},[36,767,72],{"class":50},[36,769,770],{"class":75}," 200",[36,772,125],{"class":50},[36,774,775],{"class":38,"line":79},[36,776,83],{"emptyLinePlaceholder":82},[36,778,779,782,784,787,789,791],{"class":38,"line":86},[36,780,781],{"class":89},"message",[36,783,72],{"class":50},[36,785,786],{"class":89}," code ",[36,788,99],{"class":98},[36,790,749],{"class":102},[36,792,105],{"class":50},[36,794,795],{"class":38,"line":108},[36,796,83],{"emptyLinePlaceholder":82},[36,798,799,801,803,805],{"class":38,"line":113},[36,800,117],{"class":116},[36,802,120],{"class":50},[36,804,781],{"class":102},[36,806,125],{"class":50},[36,808,809,811,813,815],{"class":38,"line":128},[36,810,117],{"class":116},[36,812,120],{"class":50},[36,814,33],{"class":102},[36,816,125],{"class":50},[14,818,140],{},[26,820,822],{"className":28,"code":821,"language":30,"meta":31,"style":31},"success\n200\n",[33,823,824,829],{"__ignoreMap":31},[36,825,826],{"class":38,"line":39},[36,827,828],{"class":89},"success\n",[36,830,831],{"class":38,"line":54},[36,832,833],{"class":75},"200\n",[14,835,836],{},"This behaves the same as:",[26,838,840],{"className":28,"code":839,"language":30,"meta":31,"style":31},"def get_status():\n    return \"success\", 200\n",[33,841,842,850],{"__ignoreMap":31},[36,843,844,846,848],{"class":38,"line":39},[36,845,43],{"class":42},[36,847,749],{"class":46},[36,849,51],{"class":50},[36,851,852,854,856,858,860,862],{"class":38,"line":54},[36,853,58],{"class":57},[36,855,62],{"class":61},[36,857,763],{"class":65},[36,859,69],{"class":61},[36,861,72],{"class":50},[36,863,864],{"class":75}," 200\n",[14,866,867],{},"In most cases, parentheses are optional. Many programmers still use them because they make it more obvious that the function returns a tuple.",[14,869,870,871,416],{},"If tuples are new to you, see ",[186,872,874],{"href":873},"\u002Fglossary\u002Fwhat-is-a-tuple-in-python","what is a tuple in Python",[21,876,878],{"id":877},"when-to-return-a-list-or-dictionary-instead","When to return a list or dictionary instead",[14,880,881],{},"A tuple is not always the clearest choice.",[604,883,885],{"id":884},"return-a-list-when-you-have-similar-items","Return a list when you have similar items",[14,887,888],{},"Use a list when the function returns a collection of values of the same kind.",[26,890,892],{"className":28,"code":891,"language":30,"meta":31,"style":31},"def get_scores():\n    return [85, 90, 78]\n\nscores = get_scores()\nprint(scores)\n",[33,893,894,903,926,930,941],{"__ignoreMap":31},[36,895,896,898,901],{"class":38,"line":39},[36,897,43],{"class":42},[36,899,900],{"class":46}," get_scores",[36,902,51],{"class":50},[36,904,905,907,910,913,915,918,920,923],{"class":38,"line":54},[36,906,58],{"class":57},[36,908,909],{"class":50}," [",[36,911,912],{"class":75},"85",[36,914,72],{"class":50},[36,916,917],{"class":75}," 90",[36,919,72],{"class":50},[36,921,922],{"class":75}," 78",[36,924,925],{"class":50},"]\n",[36,927,928],{"class":38,"line":79},[36,929,83],{"emptyLinePlaceholder":82},[36,931,932,935,937,939],{"class":38,"line":86},[36,933,934],{"class":89},"scores ",[36,936,99],{"class":98},[36,938,900],{"class":102},[36,940,105],{"class":50},[36,942,943,945,947,950],{"class":38,"line":108},[36,944,117],{"class":116},[36,946,120],{"class":50},[36,948,949],{"class":102},"scores",[36,951,125],{"class":50},[14,953,140],{},[26,955,957],{"className":28,"code":956,"language":30,"meta":31,"style":31},"[85, 90, 78]\n",[33,958,959],{"__ignoreMap":31},[36,960,961,963,965,967,969,971,973],{"class":38,"line":39},[36,962,564],{"class":50},[36,964,912],{"class":75},[36,966,72],{"class":50},[36,968,917],{"class":75},[36,970,72],{"class":50},[36,972,922],{"class":75},[36,974,925],{"class":50},[14,976,977],{},"A list makes sense here because the result is one group of similar items.",[604,979,981],{"id":980},"return-a-dictionary-when-names-matter","Return a dictionary when names matter",[14,983,984],{},"Use a dictionary when each returned value needs a label.",[26,986,988],{"className":28,"code":987,"language":30,"meta":31,"style":31},"def get_user():\n    return {\n        \"name\": \"Alice\",\n        \"age\": 25,\n        \"country\": \"Canada\"\n    }\n\nuser = get_user()\nprint(user[\"name\"])\nprint(user[\"age\"])\nprint(user[\"country\"])\n",[33,989,990,999,1006,1027,1042,1061,1066,1070,1082,1102,1121],{"__ignoreMap":31},[36,991,992,994,997],{"class":38,"line":39},[36,993,43],{"class":42},[36,995,996],{"class":46}," get_user",[36,998,51],{"class":50},[36,1000,1001,1003],{"class":38,"line":54},[36,1002,58],{"class":57},[36,1004,1005],{"class":50}," {\n",[36,1007,1008,1011,1013,1015,1018,1020,1022,1024],{"class":38,"line":79},[36,1009,1010],{"class":61},"        \"",[36,1012,90],{"class":65},[36,1014,69],{"class":61},[36,1016,1017],{"class":50},":",[36,1019,62],{"class":61},[36,1021,66],{"class":65},[36,1023,69],{"class":61},[36,1025,1026],{"class":50},",\n",[36,1028,1029,1031,1033,1035,1037,1040],{"class":38,"line":86},[36,1030,1010],{"class":61},[36,1032,135],{"class":65},[36,1034,69],{"class":61},[36,1036,1017],{"class":50},[36,1038,1039],{"class":75}," 25",[36,1041,1026],{"class":50},[36,1043,1044,1046,1049,1051,1053,1055,1058],{"class":38,"line":108},[36,1045,1010],{"class":61},[36,1047,1048],{"class":65},"country",[36,1050,69],{"class":61},[36,1052,1017],{"class":50},[36,1054,62],{"class":61},[36,1056,1057],{"class":65},"Canada",[36,1059,1060],{"class":61},"\"\n",[36,1062,1063],{"class":38,"line":113},[36,1064,1065],{"class":50},"    }\n",[36,1067,1068],{"class":38,"line":128},[36,1069,83],{"emptyLinePlaceholder":82},[36,1071,1073,1076,1078,1080],{"class":38,"line":1072},8,[36,1074,1075],{"class":89},"user ",[36,1077,99],{"class":98},[36,1079,996],{"class":102},[36,1081,105],{"class":50},[36,1083,1085,1087,1089,1092,1094,1096,1098,1100],{"class":38,"line":1084},9,[36,1086,117],{"class":116},[36,1088,120],{"class":50},[36,1090,1091],{"class":102},"user",[36,1093,564],{"class":50},[36,1095,69],{"class":61},[36,1097,90],{"class":65},[36,1099,69],{"class":61},[36,1101,570],{"class":50},[36,1103,1105,1107,1109,1111,1113,1115,1117,1119],{"class":38,"line":1104},10,[36,1106,117],{"class":116},[36,1108,120],{"class":50},[36,1110,1091],{"class":102},[36,1112,564],{"class":50},[36,1114,69],{"class":61},[36,1116,135],{"class":65},[36,1118,69],{"class":61},[36,1120,570],{"class":50},[36,1122,1124,1126,1128,1130,1132,1134,1136,1138],{"class":38,"line":1123},11,[36,1125,117],{"class":116},[36,1127,120],{"class":50},[36,1129,1091],{"class":102},[36,1131,564],{"class":50},[36,1133,69],{"class":61},[36,1135,1048],{"class":65},[36,1137,69],{"class":61},[36,1139,570],{"class":50},[14,1141,140],{},[26,1143,1145],{"className":28,"code":1144,"language":30,"meta":31,"style":31},"Alice\n25\nCanada\n",[33,1146,1147,1151,1155],{"__ignoreMap":31},[36,1148,1149],{"class":38,"line":39},[36,1150,150],{"class":89},[36,1152,1153],{"class":38,"line":54},[36,1154,155],{"class":75},[36,1156,1157],{"class":38,"line":79},[36,1158,1159],{"class":89},"Canada\n",[14,1161,1162],{},"A dictionary is often easier to read when:",[167,1164,1165,1168,1171],{},[170,1166,1167],{},"You return many values",[170,1169,1170],{},"The order is hard to remember",[170,1172,1173],{},"The meaning of each value matters more than position",[14,1175,1176],{},"Compare these two styles:",[26,1178,1180],{"className":28,"code":1179,"language":30,"meta":31,"style":31},"def get_user_tuple():\n    return \"Alice\", 25, \"Canada\"\n\nname, age, country = get_user_tuple()\nprint(name, age, country)\n",[33,1181,1182,1191,1213,1217,1237],{"__ignoreMap":31},[36,1183,1184,1186,1189],{"class":38,"line":39},[36,1185,43],{"class":42},[36,1187,1188],{"class":46}," get_user_tuple",[36,1190,51],{"class":50},[36,1192,1193,1195,1197,1199,1201,1203,1205,1207,1209,1211],{"class":38,"line":54},[36,1194,58],{"class":57},[36,1196,62],{"class":61},[36,1198,66],{"class":65},[36,1200,69],{"class":61},[36,1202,72],{"class":50},[36,1204,1039],{"class":75},[36,1206,72],{"class":50},[36,1208,62],{"class":61},[36,1210,1057],{"class":65},[36,1212,1060],{"class":61},[36,1214,1215],{"class":38,"line":79},[36,1216,83],{"emptyLinePlaceholder":82},[36,1218,1219,1221,1223,1226,1228,1231,1233,1235],{"class":38,"line":86},[36,1220,90],{"class":89},[36,1222,72],{"class":50},[36,1224,1225],{"class":89}," age",[36,1227,72],{"class":50},[36,1229,1230],{"class":89}," country ",[36,1232,99],{"class":98},[36,1234,1188],{"class":102},[36,1236,105],{"class":50},[36,1238,1239,1241,1243,1245,1247,1249,1251,1254],{"class":38,"line":108},[36,1240,117],{"class":116},[36,1242,120],{"class":50},[36,1244,90],{"class":102},[36,1246,72],{"class":50},[36,1248,1225],{"class":102},[36,1250,72],{"class":50},[36,1252,1253],{"class":102}," country",[36,1255,125],{"class":50},[26,1257,1259],{"className":28,"code":1258,"language":30,"meta":31,"style":31},"def get_user_dict():\n    return {\"name\": \"Alice\", \"age\": 25, \"country\": \"Canada\"}\n\nuser = get_user_dict()\nprint(user[\"name\"], user[\"age\"], user[\"country\"])\n",[33,1260,1261,1270,1322,1326,1336],{"__ignoreMap":31},[36,1262,1263,1265,1268],{"class":38,"line":39},[36,1264,43],{"class":42},[36,1266,1267],{"class":46}," get_user_dict",[36,1269,51],{"class":50},[36,1271,1272,1274,1277,1279,1281,1283,1285,1287,1289,1291,1293,1295,1297,1299,1301,1303,1305,1307,1309,1311,1313,1315,1317,1319],{"class":38,"line":54},[36,1273,58],{"class":57},[36,1275,1276],{"class":50}," {",[36,1278,69],{"class":61},[36,1280,90],{"class":65},[36,1282,69],{"class":61},[36,1284,1017],{"class":50},[36,1286,62],{"class":61},[36,1288,66],{"class":65},[36,1290,69],{"class":61},[36,1292,72],{"class":50},[36,1294,62],{"class":61},[36,1296,135],{"class":65},[36,1298,69],{"class":61},[36,1300,1017],{"class":50},[36,1302,1039],{"class":75},[36,1304,72],{"class":50},[36,1306,62],{"class":61},[36,1308,1048],{"class":65},[36,1310,69],{"class":61},[36,1312,1017],{"class":50},[36,1314,62],{"class":61},[36,1316,1057],{"class":65},[36,1318,69],{"class":61},[36,1320,1321],{"class":50},"}\n",[36,1323,1324],{"class":38,"line":79},[36,1325,83],{"emptyLinePlaceholder":82},[36,1327,1328,1330,1332,1334],{"class":38,"line":86},[36,1329,1075],{"class":89},[36,1331,99],{"class":98},[36,1333,1267],{"class":102},[36,1335,105],{"class":50},[36,1337,1338,1340,1342,1344,1346,1348,1350,1352,1355,1358,1360,1362,1364,1366,1368,1370,1372,1374,1376,1378],{"class":38,"line":108},[36,1339,117],{"class":116},[36,1341,120],{"class":50},[36,1343,1091],{"class":102},[36,1345,564],{"class":50},[36,1347,69],{"class":61},[36,1349,90],{"class":65},[36,1351,69],{"class":61},[36,1353,1354],{"class":50},"],",[36,1356,1357],{"class":102}," user",[36,1359,564],{"class":50},[36,1361,69],{"class":61},[36,1363,135],{"class":65},[36,1365,69],{"class":61},[36,1367,1354],{"class":50},[36,1369,1357],{"class":102},[36,1371,564],{"class":50},[36,1373,69],{"class":61},[36,1375,1048],{"class":65},[36,1377,69],{"class":61},[36,1379,570],{"class":50},[14,1381,1382],{},"Both work. Choose the one that makes your code easier to understand.",[21,1384,1386],{"id":1385},"common-errors-when-returning-multiple-values","Common errors when returning multiple values",[14,1388,1389],{},"There are a few beginner mistakes to watch for.",[604,1391,1393],{"id":1392},"unpacking-into-too-many-variables","Unpacking into too many variables",[26,1395,1397],{"className":28,"code":1396,"language":30,"meta":31,"style":31},"def get_point():\n    return 5, 10\n\nx, y, z = get_point()\n",[33,1398,1399,1408,1420,1424],{"__ignoreMap":31},[36,1400,1401,1403,1406],{"class":38,"line":39},[36,1402,43],{"class":42},[36,1404,1405],{"class":46}," get_point",[36,1407,51],{"class":50},[36,1409,1410,1412,1415,1417],{"class":38,"line":54},[36,1411,58],{"class":57},[36,1413,1414],{"class":75}," 5",[36,1416,72],{"class":50},[36,1418,1419],{"class":75}," 10\n",[36,1421,1422],{"class":38,"line":79},[36,1423,83],{"emptyLinePlaceholder":82},[36,1425,1426,1429,1431,1434,1436,1439,1441,1443],{"class":38,"line":86},[36,1427,1428],{"class":89},"x",[36,1430,72],{"class":50},[36,1432,1433],{"class":89}," y",[36,1435,72],{"class":50},[36,1437,1438],{"class":89}," z ",[36,1440,99],{"class":98},[36,1442,1405],{"class":102},[36,1444,105],{"class":50},[14,1446,1447,1448,1451],{},"This raises a ",[33,1449,1450],{},"ValueError"," because the function returned only 2 values, but you tried to store them in 3 variables.",[604,1453,1455],{"id":1454},"unpacking-into-too-few-variables","Unpacking into too few variables",[26,1457,1459],{"className":28,"code":1458,"language":30,"meta":31,"style":31},"def get_point():\n    return 5, 10\n\nx = get_point()\nprint(x)\n",[33,1460,1461,1469,1479,1483,1494],{"__ignoreMap":31},[36,1462,1463,1465,1467],{"class":38,"line":39},[36,1464,43],{"class":42},[36,1466,1405],{"class":46},[36,1468,51],{"class":50},[36,1470,1471,1473,1475,1477],{"class":38,"line":54},[36,1472,58],{"class":57},[36,1474,1414],{"class":75},[36,1476,72],{"class":50},[36,1478,1419],{"class":75},[36,1480,1481],{"class":38,"line":79},[36,1482,83],{"emptyLinePlaceholder":82},[36,1484,1485,1488,1490,1492],{"class":38,"line":86},[36,1486,1487],{"class":89},"x ",[36,1489,99],{"class":98},[36,1491,1405],{"class":102},[36,1493,105],{"class":50},[36,1495,1496,1498,1500,1502],{"class":38,"line":108},[36,1497,117],{"class":116},[36,1499,120],{"class":50},[36,1501,1428],{"class":102},[36,1503,125],{"class":50},[14,1505,1506,1507,1509],{},"This does not raise an error, but ",[33,1508,1428],{}," becomes the whole tuple:",[26,1511,1513],{"className":28,"code":1512,"language":30,"meta":31,"style":31},"(5, 10)\n",[33,1514,1515],{"__ignoreMap":31},[36,1516,1517,1519,1522,1524,1526],{"class":38,"line":39},[36,1518,120],{"class":50},[36,1520,1521],{"class":75},"5",[36,1523,72],{"class":50},[36,1525,222],{"class":75},[36,1527,125],{"class":50},[14,1529,1530],{},"The real unpacking error happens when you do this:",[26,1532,1534],{"className":28,"code":1533,"language":30,"meta":31,"style":31},"def get_point():\n    return 5, 10\n\nx, = get_point()\n",[33,1535,1536,1544,1554,1558],{"__ignoreMap":31},[36,1537,1538,1540,1542],{"class":38,"line":39},[36,1539,43],{"class":42},[36,1541,1405],{"class":46},[36,1543,51],{"class":50},[36,1545,1546,1548,1550,1552],{"class":38,"line":54},[36,1547,58],{"class":57},[36,1549,1414],{"class":75},[36,1551,72],{"class":50},[36,1553,1419],{"class":75},[36,1555,1556],{"class":38,"line":79},[36,1557,83],{"emptyLinePlaceholder":82},[36,1559,1560,1562,1564,1567,1569],{"class":38,"line":86},[36,1561,1428],{"class":89},[36,1563,72],{"class":50},[36,1565,1566],{"class":98}," =",[36,1568,1405],{"class":102},[36,1570,105],{"class":50},[14,1572,1447,1573,1575],{},[33,1574,1450],{}," because Python expected 1 value but got 2.",[14,1577,1578],{},"For fixes, see:",[167,1580,1581,1587],{},[170,1582,1583],{},[186,1584,1586],{"href":1585},"\u002Ferrors\u002Fvalueerror-too-many-values-to-unpack-fix","ValueError: too many values to unpack",[170,1588,1589],{},[186,1590,1592],{"href":1591},"\u002Ferrors\u002Fvalueerror-not-enough-values-to-unpack-fix","ValueError: not enough values to unpack",[604,1594,1596],{"id":1595},"returning-different-numbers-of-values","Returning different numbers of values",[14,1598,1599],{},"Be careful not to return 1 value in one case and 2 values in another.",[26,1601,1603],{"className":28,"code":1602,"language":30,"meta":31,"style":31},"def get_data(found):\n    if found:\n        return \"Alice\", 25\n    return \"Not found\"\n",[33,1604,1605,1621,1632,1647],{"__ignoreMap":31},[36,1606,1607,1609,1612,1614,1618],{"class":38,"line":39},[36,1608,43],{"class":42},[36,1610,1611],{"class":46}," get_data",[36,1613,120],{"class":50},[36,1615,1617],{"class":1616},"sFwrP","found",[36,1619,1620],{"class":50},"):\n",[36,1622,1623,1626,1629],{"class":38,"line":54},[36,1624,1625],{"class":57},"    if",[36,1627,1628],{"class":89}," found",[36,1630,1631],{"class":50},":\n",[36,1633,1634,1637,1639,1641,1643,1645],{"class":38,"line":79},[36,1635,1636],{"class":57},"        return",[36,1638,62],{"class":61},[36,1640,66],{"class":65},[36,1642,69],{"class":61},[36,1644,72],{"class":50},[36,1646,76],{"class":75},[36,1648,1649,1651,1653,1656],{"class":38,"line":86},[36,1650,58],{"class":57},[36,1652,62],{"class":61},[36,1654,1655],{"class":65},"Not found",[36,1657,1060],{"class":61},[14,1659,1660],{},"This can confuse the code that calls the function:",[26,1662,1664],{"className":28,"code":1663,"language":30,"meta":31,"style":31},"name, age = get_data(False)\n",[33,1665,1666],{"__ignoreMap":31},[36,1667,1668,1670,1672,1674,1676,1678,1680,1684],{"class":38,"line":39},[36,1669,90],{"class":89},[36,1671,72],{"class":50},[36,1673,95],{"class":89},[36,1675,99],{"class":98},[36,1677,1611],{"class":102},[36,1679,120],{"class":50},[36,1681,1683],{"class":1682},"s39Yj","False",[36,1685,125],{"class":50},[14,1687,1688],{},"That code will fail because the function did not always return the same kind of result.",[14,1690,1691],{},"A clearer version would be:",[26,1693,1695],{"className":28,"code":1694,"language":30,"meta":31,"style":31},"def get_data(found):\n    if found:\n        return \"Alice\", 25\n    return None, None\n\nname, age = get_data(False)\nprint(name)\nprint(age)\n",[33,1696,1697,1709,1717,1731,1743,1747,1765,1775],{"__ignoreMap":31},[36,1698,1699,1701,1703,1705,1707],{"class":38,"line":39},[36,1700,43],{"class":42},[36,1702,1611],{"class":46},[36,1704,120],{"class":50},[36,1706,1617],{"class":1616},[36,1708,1620],{"class":50},[36,1710,1711,1713,1715],{"class":38,"line":54},[36,1712,1625],{"class":57},[36,1714,1628],{"class":89},[36,1716,1631],{"class":50},[36,1718,1719,1721,1723,1725,1727,1729],{"class":38,"line":79},[36,1720,1636],{"class":57},[36,1722,62],{"class":61},[36,1724,66],{"class":65},[36,1726,69],{"class":61},[36,1728,72],{"class":50},[36,1730,76],{"class":75},[36,1732,1733,1735,1738,1740],{"class":38,"line":86},[36,1734,58],{"class":57},[36,1736,1737],{"class":1682}," None",[36,1739,72],{"class":50},[36,1741,1742],{"class":1682}," None\n",[36,1744,1745],{"class":38,"line":108},[36,1746,83],{"emptyLinePlaceholder":82},[36,1748,1749,1751,1753,1755,1757,1759,1761,1763],{"class":38,"line":113},[36,1750,90],{"class":89},[36,1752,72],{"class":50},[36,1754,95],{"class":89},[36,1756,99],{"class":98},[36,1758,1611],{"class":102},[36,1760,120],{"class":50},[36,1762,1683],{"class":1682},[36,1764,125],{"class":50},[36,1766,1767,1769,1771,1773],{"class":38,"line":128},[36,1768,117],{"class":116},[36,1770,120],{"class":50},[36,1772,90],{"class":102},[36,1774,125],{"class":50},[36,1776,1777,1779,1781,1783],{"class":38,"line":1072},[36,1778,117],{"class":116},[36,1780,120],{"class":50},[36,1782,135],{"class":102},[36,1784,125],{"class":50},[14,1786,140],{},[26,1788,1790],{"className":28,"code":1789,"language":30,"meta":31,"style":31},"None\nNone\n",[33,1791,1792,1797],{"__ignoreMap":31},[36,1793,1794],{"class":38,"line":39},[36,1795,1796],{"class":1682},"None\n",[36,1798,1799],{"class":38,"line":54},[36,1800,1796],{"class":1682},[604,1802,1804],{"id":1803},"forgetting-the-return-order","Forgetting the return order",[14,1806,1807],{},"If your function returns values in a fixed order, make sure that order stays consistent.",[26,1809,1811],{"className":28,"code":1810,"language":30,"meta":31,"style":31},"def get_size():\n    return 800, 600  # width, height\n\nwidth, height = get_size()\n",[33,1812,1813,1822,1838,1842],{"__ignoreMap":31},[36,1814,1815,1817,1820],{"class":38,"line":39},[36,1816,43],{"class":42},[36,1818,1819],{"class":46}," get_size",[36,1821,51],{"class":50},[36,1823,1824,1826,1829,1831,1834],{"class":38,"line":54},[36,1825,58],{"class":57},[36,1827,1828],{"class":75}," 800",[36,1830,72],{"class":50},[36,1832,1833],{"class":75}," 600",[36,1835,1837],{"class":1836},"sutJx","  # width, height\n",[36,1839,1840],{"class":38,"line":79},[36,1841,83],{"emptyLinePlaceholder":82},[36,1843,1844,1846,1848,1850,1852,1854],{"class":38,"line":86},[36,1845,648],{"class":89},[36,1847,72],{"class":50},[36,1849,653],{"class":89},[36,1851,99],{"class":98},[36,1853,1819],{"class":102},[36,1855,105],{"class":50},[14,1857,1858],{},"If you later change the function to return height first, your code may still run but produce wrong results.",[21,1860,1862],{"id":1861},"best-practices-for-beginners","Best practices for beginners",[14,1864,1865],{},"When returning multiple values from a function:",[167,1867,1868,1871,1874,1877,1880],{},[170,1869,1870],{},"Keep the return order consistent",[170,1872,1873],{},"Use tuple unpacking for short, simple results",[170,1875,1876],{},"Use dictionaries when names matter more than order",[170,1878,1879],{},"Use clear variable names",[170,1881,1882],{},"Keep the returned structure the same in all code paths",[14,1884,1885],{},"Good example:",[26,1887,1889],{"className":28,"code":1888,"language":30,"meta":31,"style":31},"def get_product():\n    return \"Book\", 12.99\n\nproduct_name, price = get_product()\nprint(product_name)\nprint(price)\n",[33,1890,1891,1900,1916,1920,1936,1946],{"__ignoreMap":31},[36,1892,1893,1895,1898],{"class":38,"line":39},[36,1894,43],{"class":42},[36,1896,1897],{"class":46}," get_product",[36,1899,51],{"class":50},[36,1901,1902,1904,1906,1909,1911,1913],{"class":38,"line":54},[36,1903,58],{"class":57},[36,1905,62],{"class":61},[36,1907,1908],{"class":65},"Book",[36,1910,69],{"class":61},[36,1912,72],{"class":50},[36,1914,1915],{"class":75}," 12.99\n",[36,1917,1918],{"class":38,"line":79},[36,1919,83],{"emptyLinePlaceholder":82},[36,1921,1922,1925,1927,1930,1932,1934],{"class":38,"line":86},[36,1923,1924],{"class":89},"product_name",[36,1926,72],{"class":50},[36,1928,1929],{"class":89}," price ",[36,1931,99],{"class":98},[36,1933,1897],{"class":102},[36,1935,105],{"class":50},[36,1937,1938,1940,1942,1944],{"class":38,"line":108},[36,1939,117],{"class":116},[36,1941,120],{"class":50},[36,1943,1924],{"class":102},[36,1945,125],{"class":50},[36,1947,1948,1950,1952,1955],{"class":38,"line":113},[36,1949,117],{"class":116},[36,1951,120],{"class":50},[36,1953,1954],{"class":102},"price",[36,1956,125],{"class":50},[14,1958,1959],{},"Less clear example:",[26,1961,1963],{"className":28,"code":1962,"language":30,"meta":31,"style":31},"def get_product():\n    return \"Book\", 12.99\n\nx, y = get_product()\nprint(x)\nprint(y)\n",[33,1964,1965,1973,1987,1991,2006,2016],{"__ignoreMap":31},[36,1966,1967,1969,1971],{"class":38,"line":39},[36,1968,43],{"class":42},[36,1970,1897],{"class":46},[36,1972,51],{"class":50},[36,1974,1975,1977,1979,1981,1983,1985],{"class":38,"line":54},[36,1976,58],{"class":57},[36,1978,62],{"class":61},[36,1980,1908],{"class":65},[36,1982,69],{"class":61},[36,1984,72],{"class":50},[36,1986,1915],{"class":75},[36,1988,1989],{"class":38,"line":79},[36,1990,83],{"emptyLinePlaceholder":82},[36,1992,1993,1995,1997,2000,2002,2004],{"class":38,"line":86},[36,1994,1428],{"class":89},[36,1996,72],{"class":50},[36,1998,1999],{"class":89}," y ",[36,2001,99],{"class":98},[36,2003,1897],{"class":102},[36,2005,105],{"class":50},[36,2007,2008,2010,2012,2014],{"class":38,"line":108},[36,2009,117],{"class":116},[36,2011,120],{"class":50},[36,2013,1428],{"class":102},[36,2015,125],{"class":50},[36,2017,2018,2020,2022,2025],{"class":38,"line":113},[36,2019,117],{"class":116},[36,2021,120],{"class":50},[36,2023,2024],{"class":102},"y",[36,2026,125],{"class":50},[14,2028,2029,2030,2032,2033,2035],{},"The second example works, but ",[33,2031,1428],{}," and ",[33,2034,2024],{}," do not tell the reader what the values mean.",[21,2037,2039],{"id":2038},"common-mistakes","Common mistakes",[14,2041,2042],{},"These problems often cause confusion:",[167,2044,2045,2048,2051,2054],{},[170,2046,2047],{},"Trying to use multiple variables without unpacking the returned result",[170,2049,2050],{},"Returning a different number of values in different code paths",[170,2052,2053],{},"Confusing tuple return values with separate return statements",[170,2055,2056,2057,2060],{},"Using unclear value order such as ",[33,2058,2059],{},"return x, y"," without meaningful names",[14,2062,2063,2064,416],{},"If you want a refresher on what a return value is, read ",[186,2065,2067],{"href":2066},"\u002Fglossary\u002Fwhat-is-a-return-value-in-python","what is a return value in Python",[21,2069,2071],{"id":2070},"faq","FAQ",[604,2073,2075],{"id":2074},"does-python-really-return-multiple-values","Does Python really return multiple values?",[14,2077,2078],{},"Usually, Python returns one tuple object that contains multiple values.",[604,2080,2082],{"id":2081},"do-i-need-parentheses-when-returning-multiple-values","Do I need parentheses when returning multiple values?",[14,2084,2085],{},"No. Parentheses are optional in most return statements, but they can improve readability.",[604,2087,2089],{"id":2088},"can-i-return-a-list-instead-of-a-tuple","Can I return a list instead of a tuple?",[14,2091,2092],{},"Yes. A list is useful when you want a collection of similar items that may be changed later.",[604,2094,2096],{"id":2095},"why-do-i-get-too-many-values-to-unpack","Why do I get \"too many values to unpack\"?",[14,2098,2099],{},"Your function returned more items than the number of variables on the left side.",[604,2101,2103],{"id":2102},"what-is-the-clearest-way-to-return-many-related-values","What is the clearest way to return many related values?",[14,2105,2106],{},"For more complex results, a dictionary is often easier to read because each value has a key.",[21,2108,2110],{"id":2109},"see-also","See also",[167,2112,2113,2117,2122,2128,2132,2136,2141],{},[170,2114,2115],{},[186,2116,189],{"href":188},[170,2118,2119],{},[186,2120,2121],{"href":414},"Return values in Python functions",[170,2123,2124],{},[186,2125,2127],{"href":2126},"\u002Fhow-to\u002Fhow-to-create-a-simple-function-in-python\u002F","How to create a simple function in Python",[170,2129,2130],{},[186,2131,1586],{"href":1585},[170,2133,2134],{},[186,2135,1592],{"href":1591},[170,2137,2138],{},[186,2139,2140],{"href":2066},"What is a return value in Python",[170,2142,2143],{},[186,2144,2145],{"href":873},"What is a tuple in Python",[2147,2148,2149],"style",{},"html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .slqww, html code.shiki .slqww{--shiki-light:#6182B8;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sptTA, html code.shiki .sptTA{--shiki-light:#6182B8;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sFwrP, html code.shiki .sFwrP{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#24292E;--shiki-default-font-style:inherit;--shiki-dark:#E1E4E8;--shiki-dark-font-style:inherit}html pre.shiki code .s39Yj, html code.shiki .s39Yj{--shiki-light:#39ADB5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}",{"title":31,"searchDepth":54,"depth":54,"links":2151},[2152,2153,2154,2155,2158,2159,2163,2169,2170,2171,2178],{"id":23,"depth":54,"text":24},{"id":161,"depth":54,"text":162},{"id":193,"depth":54,"text":194},{"id":419,"depth":54,"text":420,"children":2156},[2157],{"id":606,"depth":79,"text":607},{"id":733,"depth":54,"text":734},{"id":877,"depth":54,"text":878,"children":2160},[2161,2162],{"id":884,"depth":79,"text":885},{"id":980,"depth":79,"text":981},{"id":1385,"depth":54,"text":1386,"children":2164},[2165,2166,2167,2168],{"id":1392,"depth":79,"text":1393},{"id":1454,"depth":79,"text":1455},{"id":1595,"depth":79,"text":1596},{"id":1803,"depth":79,"text":1804},{"id":1861,"depth":54,"text":1862},{"id":2038,"depth":54,"text":2039},{"id":2070,"depth":54,"text":2071,"children":2172},[2173,2174,2175,2176,2177],{"id":2074,"depth":79,"text":2075},{"id":2081,"depth":79,"text":2082},{"id":2088,"depth":79,"text":2089},{"id":2095,"depth":79,"text":2096},{"id":2102,"depth":79,"text":2103},{"id":2109,"depth":54,"text":2110},"Master how to return multiple values from a function in python in our comprehensive Python beginner guide.","md",{},"\u002Fhow-to\u002Fhow-to-return-multiple-values-from-a-function-in-python",{"title":5,"description":2179},"how-to\u002Fhow-to-return-multiple-values-from-a-function-in-python","giWUa7VPTN812YN9HvRxnzj3NtT541Ki5NLdpNd5q3k",1777585486426]