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