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