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