[{"data":1,"prerenderedAt":823},["ShallowReactive",2],{"content-\u002Fcompetitive-programming\u002Fmath-library\u002Fsummary":3,"related-\u002Fcompetitive-programming\u002Fmath-library\u002Fsummary":694,"sidebar-content":798},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"tags":10,"date":14,"weight":15,"body":16,"_type":688,"_id":689,"_source":690,"_file":691,"_stem":692,"_extension":693},"\u002Fcompetitive-programming\u002Fmath-library\u002Fsummary","math-library",false,"","Summary","Summary of the math library in Python.",[11,12,13],"python","backend","arrays","2026-03-18",10,{"type":17,"children":18,"toc":679},"root",[19,28,34,41,55,178,184,196,296,302,314,414,420,432,499,505,526,673],{"type":20,"tag":21,"props":22,"children":24},"element","h2",{"id":23},"summary-of-math-library-in-python",[25],{"type":26,"value":27},"text","Summary of Math Library in Python",{"type":20,"tag":29,"props":30,"children":31},"p",{},[32],{"type":26,"value":33},"The math library in Python provides various mathematical functions and constants. Here are some commonly used functions and constants:",{"type":20,"tag":35,"props":36,"children":38},"h3",{"id":37},"sum-of-elements",[39],{"type":26,"value":40},"Sum of Elements",{"type":20,"tag":29,"props":42,"children":43},{},[44,46,53],{"type":26,"value":45},"You can sum elements in a list using the built-in ",{"type":20,"tag":47,"props":48,"children":50},"code",{"className":49},[],[51],{"type":26,"value":52},"sum()",{"type":26,"value":54}," function:",{"type":20,"tag":56,"props":57,"children":60},"pre",{"className":58,"code":59,"language":11,"meta":7,"style":7},"language-python shiki shiki-themes github-light github-dark","numbers = [1, 2, 3, 4, 5]\ntotal = sum(numbers)\nprint(total)  # Output: 15\n",[61],{"type":20,"tag":47,"props":62,"children":63},{"__ignoreMap":7},[64,135,158],{"type":20,"tag":65,"props":66,"children":69},"span",{"class":67,"line":68},"line",1,[70,76,82,87,93,98,103,107,112,116,121,125,130],{"type":20,"tag":65,"props":71,"children":73},{"style":72},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[74],{"type":26,"value":75},"numbers ",{"type":20,"tag":65,"props":77,"children":79},{"style":78},"--shiki-default:#D73A49;--shiki-dark:#F97583",[80],{"type":26,"value":81},"=",{"type":20,"tag":65,"props":83,"children":84},{"style":72},[85],{"type":26,"value":86}," [",{"type":20,"tag":65,"props":88,"children":90},{"style":89},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[91],{"type":26,"value":92},"1",{"type":20,"tag":65,"props":94,"children":95},{"style":72},[96],{"type":26,"value":97},", ",{"type":20,"tag":65,"props":99,"children":100},{"style":89},[101],{"type":26,"value":102},"2",{"type":20,"tag":65,"props":104,"children":105},{"style":72},[106],{"type":26,"value":97},{"type":20,"tag":65,"props":108,"children":109},{"style":89},[110],{"type":26,"value":111},"3",{"type":20,"tag":65,"props":113,"children":114},{"style":72},[115],{"type":26,"value":97},{"type":20,"tag":65,"props":117,"children":118},{"style":89},[119],{"type":26,"value":120},"4",{"type":20,"tag":65,"props":122,"children":123},{"style":72},[124],{"type":26,"value":97},{"type":20,"tag":65,"props":126,"children":127},{"style":89},[128],{"type":26,"value":129},"5",{"type":20,"tag":65,"props":131,"children":132},{"style":72},[133],{"type":26,"value":134},"]\n",{"type":20,"tag":65,"props":136,"children":138},{"class":67,"line":137},2,[139,144,148,153],{"type":20,"tag":65,"props":140,"children":141},{"style":72},[142],{"type":26,"value":143},"total ",{"type":20,"tag":65,"props":145,"children":146},{"style":78},[147],{"type":26,"value":81},{"type":20,"tag":65,"props":149,"children":150},{"style":89},[151],{"type":26,"value":152}," sum",{"type":20,"tag":65,"props":154,"children":155},{"style":72},[156],{"type":26,"value":157},"(numbers)\n",{"type":20,"tag":65,"props":159,"children":161},{"class":67,"line":160},3,[162,167,172],{"type":20,"tag":65,"props":163,"children":164},{"style":89},[165],{"type":26,"value":166},"print",{"type":20,"tag":65,"props":168,"children":169},{"style":72},[170],{"type":26,"value":171},"(total)  ",{"type":20,"tag":65,"props":173,"children":175},{"style":174},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[176],{"type":26,"value":177},"# Output: 15\n",{"type":20,"tag":35,"props":179,"children":181},{"id":180},"maximum-value",[182],{"type":26,"value":183},"Maximum Value",{"type":20,"tag":29,"props":185,"children":186},{},[187,189,195],{"type":26,"value":188},"To find the maximum value in a list, you can use the ",{"type":20,"tag":47,"props":190,"children":192},{"className":191},[],[193],{"type":26,"value":194},"max()",{"type":26,"value":54},{"type":20,"tag":56,"props":197,"children":199},{"className":58,"code":198,"language":11,"meta":7,"style":7},"numbers = [1, 2, 3, 4, 5]\nmaximum = max(numbers)\nprint(maximum)  # Output: 5\n",[200],{"type":20,"tag":47,"props":201,"children":202},{"__ignoreMap":7},[203,258,279],{"type":20,"tag":65,"props":204,"children":205},{"class":67,"line":68},[206,210,214,218,222,226,230,234,238,242,246,250,254],{"type":20,"tag":65,"props":207,"children":208},{"style":72},[209],{"type":26,"value":75},{"type":20,"tag":65,"props":211,"children":212},{"style":78},[213],{"type":26,"value":81},{"type":20,"tag":65,"props":215,"children":216},{"style":72},[217],{"type":26,"value":86},{"type":20,"tag":65,"props":219,"children":220},{"style":89},[221],{"type":26,"value":92},{"type":20,"tag":65,"props":223,"children":224},{"style":72},[225],{"type":26,"value":97},{"type":20,"tag":65,"props":227,"children":228},{"style":89},[229],{"type":26,"value":102},{"type":20,"tag":65,"props":231,"children":232},{"style":72},[233],{"type":26,"value":97},{"type":20,"tag":65,"props":235,"children":236},{"style":89},[237],{"type":26,"value":111},{"type":20,"tag":65,"props":239,"children":240},{"style":72},[241],{"type":26,"value":97},{"type":20,"tag":65,"props":243,"children":244},{"style":89},[245],{"type":26,"value":120},{"type":20,"tag":65,"props":247,"children":248},{"style":72},[249],{"type":26,"value":97},{"type":20,"tag":65,"props":251,"children":252},{"style":89},[253],{"type":26,"value":129},{"type":20,"tag":65,"props":255,"children":256},{"style":72},[257],{"type":26,"value":134},{"type":20,"tag":65,"props":259,"children":260},{"class":67,"line":137},[261,266,270,275],{"type":20,"tag":65,"props":262,"children":263},{"style":72},[264],{"type":26,"value":265},"maximum ",{"type":20,"tag":65,"props":267,"children":268},{"style":78},[269],{"type":26,"value":81},{"type":20,"tag":65,"props":271,"children":272},{"style":89},[273],{"type":26,"value":274}," max",{"type":20,"tag":65,"props":276,"children":277},{"style":72},[278],{"type":26,"value":157},{"type":20,"tag":65,"props":280,"children":281},{"class":67,"line":160},[282,286,291],{"type":20,"tag":65,"props":283,"children":284},{"style":89},[285],{"type":26,"value":166},{"type":20,"tag":65,"props":287,"children":288},{"style":72},[289],{"type":26,"value":290},"(maximum)  ",{"type":20,"tag":65,"props":292,"children":293},{"style":174},[294],{"type":26,"value":295},"# Output: 5\n",{"type":20,"tag":35,"props":297,"children":299},{"id":298},"minimum-value",[300],{"type":26,"value":301},"Minimum Value",{"type":20,"tag":29,"props":303,"children":304},{},[305,307,313],{"type":26,"value":306},"To find the minimum value in a list, you can use the ",{"type":20,"tag":47,"props":308,"children":310},{"className":309},[],[311],{"type":26,"value":312},"min()",{"type":26,"value":54},{"type":20,"tag":56,"props":315,"children":317},{"className":58,"code":316,"language":11,"meta":7,"style":7},"numbers = [1, 2, 3, 4, 5]\nminimum = min(numbers)\nprint(minimum)  # Output: 1\n",[318],{"type":20,"tag":47,"props":319,"children":320},{"__ignoreMap":7},[321,376,397],{"type":20,"tag":65,"props":322,"children":323},{"class":67,"line":68},[324,328,332,336,340,344,348,352,356,360,364,368,372],{"type":20,"tag":65,"props":325,"children":326},{"style":72},[327],{"type":26,"value":75},{"type":20,"tag":65,"props":329,"children":330},{"style":78},[331],{"type":26,"value":81},{"type":20,"tag":65,"props":333,"children":334},{"style":72},[335],{"type":26,"value":86},{"type":20,"tag":65,"props":337,"children":338},{"style":89},[339],{"type":26,"value":92},{"type":20,"tag":65,"props":341,"children":342},{"style":72},[343],{"type":26,"value":97},{"type":20,"tag":65,"props":345,"children":346},{"style":89},[347],{"type":26,"value":102},{"type":20,"tag":65,"props":349,"children":350},{"style":72},[351],{"type":26,"value":97},{"type":20,"tag":65,"props":353,"children":354},{"style":89},[355],{"type":26,"value":111},{"type":20,"tag":65,"props":357,"children":358},{"style":72},[359],{"type":26,"value":97},{"type":20,"tag":65,"props":361,"children":362},{"style":89},[363],{"type":26,"value":120},{"type":20,"tag":65,"props":365,"children":366},{"style":72},[367],{"type":26,"value":97},{"type":20,"tag":65,"props":369,"children":370},{"style":89},[371],{"type":26,"value":129},{"type":20,"tag":65,"props":373,"children":374},{"style":72},[375],{"type":26,"value":134},{"type":20,"tag":65,"props":377,"children":378},{"class":67,"line":137},[379,384,388,393],{"type":20,"tag":65,"props":380,"children":381},{"style":72},[382],{"type":26,"value":383},"minimum ",{"type":20,"tag":65,"props":385,"children":386},{"style":78},[387],{"type":26,"value":81},{"type":20,"tag":65,"props":389,"children":390},{"style":89},[391],{"type":26,"value":392}," min",{"type":20,"tag":65,"props":394,"children":395},{"style":72},[396],{"type":26,"value":157},{"type":20,"tag":65,"props":398,"children":399},{"class":67,"line":160},[400,404,409],{"type":20,"tag":65,"props":401,"children":402},{"style":89},[403],{"type":26,"value":166},{"type":20,"tag":65,"props":405,"children":406},{"style":72},[407],{"type":26,"value":408},"(minimum)  ",{"type":20,"tag":65,"props":410,"children":411},{"style":174},[412],{"type":26,"value":413},"# Output: 1\n",{"type":20,"tag":35,"props":415,"children":417},{"id":416},"absolute-value",[418],{"type":26,"value":419},"Absolute Value",{"type":20,"tag":29,"props":421,"children":422},{},[423,425,431],{"type":26,"value":424},"To get the absolute value of a number, you can use the ",{"type":20,"tag":47,"props":426,"children":428},{"className":427},[],[429],{"type":26,"value":430},"abs()",{"type":26,"value":54},{"type":20,"tag":56,"props":433,"children":435},{"className":58,"code":434,"language":11,"meta":7,"style":7},"number = -5\nabsolute_value = abs(number)\nprint(absolute_value)  # Output: 5\n",[436],{"type":20,"tag":47,"props":437,"children":438},{"__ignoreMap":7},[439,461,483],{"type":20,"tag":65,"props":440,"children":441},{"class":67,"line":68},[442,447,451,456],{"type":20,"tag":65,"props":443,"children":444},{"style":72},[445],{"type":26,"value":446},"number ",{"type":20,"tag":65,"props":448,"children":449},{"style":78},[450],{"type":26,"value":81},{"type":20,"tag":65,"props":452,"children":453},{"style":78},[454],{"type":26,"value":455}," -",{"type":20,"tag":65,"props":457,"children":458},{"style":89},[459],{"type":26,"value":460},"5\n",{"type":20,"tag":65,"props":462,"children":463},{"class":67,"line":137},[464,469,473,478],{"type":20,"tag":65,"props":465,"children":466},{"style":72},[467],{"type":26,"value":468},"absolute_value ",{"type":20,"tag":65,"props":470,"children":471},{"style":78},[472],{"type":26,"value":81},{"type":20,"tag":65,"props":474,"children":475},{"style":89},[476],{"type":26,"value":477}," abs",{"type":20,"tag":65,"props":479,"children":480},{"style":72},[481],{"type":26,"value":482},"(number)\n",{"type":20,"tag":65,"props":484,"children":485},{"class":67,"line":160},[486,490,495],{"type":20,"tag":65,"props":487,"children":488},{"style":89},[489],{"type":26,"value":166},{"type":20,"tag":65,"props":491,"children":492},{"style":72},[493],{"type":26,"value":494},"(absolute_value)  ",{"type":20,"tag":65,"props":496,"children":497},{"style":174},[498],{"type":26,"value":295},{"type":20,"tag":35,"props":500,"children":502},{"id":501},"power",[503],{"type":26,"value":504},"Power",{"type":20,"tag":29,"props":506,"children":507},{},[508,510,516,518,524],{"type":26,"value":509},"To calculate the power of a number, you can use the ",{"type":20,"tag":47,"props":511,"children":513},{"className":512},[],[514],{"type":26,"value":515},"pow()",{"type":26,"value":517}," function or the exponent\noperator ",{"type":20,"tag":47,"props":519,"children":521},{"className":520},[],[522],{"type":26,"value":523},"**",{"type":26,"value":525},":",{"type":20,"tag":56,"props":527,"children":529},{"className":58,"code":528,"language":11,"meta":7,"style":7},"base = 2\nexponent = 3\npower = pow(base, exponent) # 2 ^ 3 = 8\nprint(power)  # Output: 8\n\n# Using exponent operator\npower = base ** exponent\nprint(power)  # Output: 8\n",[530],{"type":20,"tag":47,"props":531,"children":532},{"__ignoreMap":7},[533,550,567,594,612,622,631,657],{"type":20,"tag":65,"props":534,"children":535},{"class":67,"line":68},[536,541,545],{"type":20,"tag":65,"props":537,"children":538},{"style":72},[539],{"type":26,"value":540},"base ",{"type":20,"tag":65,"props":542,"children":543},{"style":78},[544],{"type":26,"value":81},{"type":20,"tag":65,"props":546,"children":547},{"style":89},[548],{"type":26,"value":549}," 2\n",{"type":20,"tag":65,"props":551,"children":552},{"class":67,"line":137},[553,558,562],{"type":20,"tag":65,"props":554,"children":555},{"style":72},[556],{"type":26,"value":557},"exponent ",{"type":20,"tag":65,"props":559,"children":560},{"style":78},[561],{"type":26,"value":81},{"type":20,"tag":65,"props":563,"children":564},{"style":89},[565],{"type":26,"value":566}," 3\n",{"type":20,"tag":65,"props":568,"children":569},{"class":67,"line":160},[570,575,579,584,589],{"type":20,"tag":65,"props":571,"children":572},{"style":72},[573],{"type":26,"value":574},"power ",{"type":20,"tag":65,"props":576,"children":577},{"style":78},[578],{"type":26,"value":81},{"type":20,"tag":65,"props":580,"children":581},{"style":89},[582],{"type":26,"value":583}," pow",{"type":20,"tag":65,"props":585,"children":586},{"style":72},[587],{"type":26,"value":588},"(base, exponent) ",{"type":20,"tag":65,"props":590,"children":591},{"style":174},[592],{"type":26,"value":593},"# 2 ^ 3 = 8\n",{"type":20,"tag":65,"props":595,"children":597},{"class":67,"line":596},4,[598,602,607],{"type":20,"tag":65,"props":599,"children":600},{"style":89},[601],{"type":26,"value":166},{"type":20,"tag":65,"props":603,"children":604},{"style":72},[605],{"type":26,"value":606},"(power)  ",{"type":20,"tag":65,"props":608,"children":609},{"style":174},[610],{"type":26,"value":611},"# Output: 8\n",{"type":20,"tag":65,"props":613,"children":615},{"class":67,"line":614},5,[616],{"type":20,"tag":65,"props":617,"children":619},{"emptyLinePlaceholder":618},true,[620],{"type":26,"value":621},"\n",{"type":20,"tag":65,"props":623,"children":625},{"class":67,"line":624},6,[626],{"type":20,"tag":65,"props":627,"children":628},{"style":174},[629],{"type":26,"value":630},"# Using exponent operator\n",{"type":20,"tag":65,"props":632,"children":634},{"class":67,"line":633},7,[635,639,643,648,652],{"type":20,"tag":65,"props":636,"children":637},{"style":72},[638],{"type":26,"value":574},{"type":20,"tag":65,"props":640,"children":641},{"style":78},[642],{"type":26,"value":81},{"type":20,"tag":65,"props":644,"children":645},{"style":72},[646],{"type":26,"value":647}," base ",{"type":20,"tag":65,"props":649,"children":650},{"style":78},[651],{"type":26,"value":523},{"type":20,"tag":65,"props":653,"children":654},{"style":72},[655],{"type":26,"value":656}," exponent\n",{"type":20,"tag":65,"props":658,"children":660},{"class":67,"line":659},8,[661,665,669],{"type":20,"tag":65,"props":662,"children":663},{"style":89},[664],{"type":26,"value":166},{"type":20,"tag":65,"props":666,"children":667},{"style":72},[668],{"type":26,"value":606},{"type":20,"tag":65,"props":670,"children":671},{"style":174},[672],{"type":26,"value":611},{"type":20,"tag":674,"props":675,"children":676},"style",{},[677],{"type":26,"value":678},"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);}",{"title":7,"searchDepth":160,"depth":160,"links":680},[681],{"id":23,"depth":137,"text":27,"children":682},[683,684,685,686,687],{"id":37,"depth":160,"text":40},{"id":180,"depth":160,"text":183},{"id":298,"depth":160,"text":301},{"id":416,"depth":160,"text":419},{"id":501,"depth":160,"text":504},"markdown","content:competitive-programming:math-library:summary.md","content","competitive-programming\u002Fmath-library\u002Fsummary.md","competitive-programming\u002Fmath-library\u002Fsummary","md",[695,700,705,711,716,721,726,731,740,746,751,756,761,766,771,779,785,792],{"_path":696,"title":697,"description":698,"tags":699,"date":14},"\u002Fcompetitive-programming\u002Farray-manipulation\u002Ffor-looping","For Looping in Python","Using for loops to manipulate arrays in Python.",[11,12,13],{"_path":701,"title":702,"description":703,"tags":704,"date":14},"\u002Fcompetitive-programming\u002Farray-manipulation\u002Fwhile-looping","While Looping in Python","Using while loops to manipulate arrays in Python.",[11,12,13],{"_path":706,"title":707,"description":708,"tags":709,"date":710},"\u002Fcompetitive-programming\u002Fassignments","Assignments","Assignments in Python for competitive programming.",[11,12],"2026-04-10",{"_path":712,"title":713,"description":714,"tags":715,"date":710},"\u002Fcompetitive-programming\u002Fdata-type","Data Types","Data types in Python for competitive programming.",[11,12],{"_path":717,"title":718,"description":719,"tags":720,"date":710},"\u002Fcompetitive-programming\u002Fhash-map","Hash Map","Hash map implementation in Python for competitive programming.",[11,12],{"_path":722,"title":723,"description":724,"tags":725,"date":710},"\u002Fcompetitive-programming\u002Finput-output","Input and Output","Handling input and output in Python for competitive programming.",[11,12],{"_path":727,"title":728,"description":729,"tags":730,"date":14},"\u002Fcompetitive-programming\u002Fmath-library\u002Fsum","Sum Elements","Using for loops to sum elements in Python.",[11,12,13],{"_path":732,"title":733,"description":734,"tags":735,"date":739},"\u002Fdocker\u002Fcheat-sheets","Docker Cheat Sheets","Cheat sheets for frequently used Docker commands and concepts",[736,737,738],"docker","devops","infrastructure","2026-05-01",{"_path":741,"title":742,"description":743,"tags":744,"date":745},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-container","Docker Container","Introduction to Docker containers and their usage",[736,737,738],"2026-03-12",{"_path":747,"title":748,"description":749,"tags":750,"date":745},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-execution","Docker Execution","Introduction to Docker execution and their usage",[736,737,738],{"_path":752,"title":753,"description":754,"tags":755,"date":745},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-image","Docker Image","Introduction to Docker images and their usage",[736,737,738],{"_path":757,"title":758,"description":759,"tags":760,"date":745},"\u002Fdocker\u002Fdocker-dasar\u002Fdocker-logging","Docker Logging","Introduction to Docker logging and their usage",[736,737,738],{"_path":762,"title":763,"description":764,"tags":765,"date":745},"\u002Fdocker\u002Fdocker-prerequisites\u002Fdocker-installation","Docker Installation","Introduction to Docker installation and their usage",[736,737,738],{"_path":767,"title":768,"description":769,"tags":770,"date":745},"\u002Fdocker\u002Fresources","Docker Resources","Collection of Docker resources for learning and reference",[736,737,738],{"_path":772,"title":773,"description":774,"tags":775,"date":745},"\u002Fjavascript\u002Fpromises","Promise Patterns","Common JavaScript promise patterns and async\u002Fawait usage",[776,777,778],"javascript","frontend","async",{"_path":780,"title":781,"description":782,"tags":783,"date":14},"\u002Fphp\u002Farrays","PHP Array Functions","Essential PHP array functions and patterns",[784,12,13],"php",{"_path":786,"title":787,"description":788,"tags":789,"date":791},"\u002Fphp\u002Fpatterns\u002Fsingleton","Singleton Pattern","Implementing the singleton pattern in PHP",[784,790,12],"patterns","2026-03-13",{"_path":793,"title":794,"description":795,"tags":796,"date":797},"\u002Fphp\u002Freferences","PHP References (&)","Useful PHP reference snippets and patterns",[784,12],"2026-03-19",[799,800,801,802,803,804,805,807,808,810,811,813,815,817,818,819,820,821,822],{"_path":696,"title":697,"weight":15},{"_path":701,"title":702,"weight":15},{"_path":706,"title":707,"weight":160},{"_path":712,"title":713,"weight":137},{"_path":717,"title":718,"weight":15},{"_path":722,"title":723,"weight":68},{"_path":727,"title":728,"weight":806},20,{"_path":4,"title":8,"weight":15},{"_path":732,"title":733,"weight":809},100,{"_path":741,"title":742,"weight":806},{"_path":747,"title":748,"weight":812},22,{"_path":752,"title":753,"weight":814},21,{"_path":757,"title":758,"weight":816},23,{"_path":762,"title":763,"weight":15},{"_path":767,"title":768,"weight":68},{"_path":772,"title":773},{"_path":780,"title":781,"weight":68},{"_path":786,"title":787},{"_path":793,"title":794,"weight":137},1777665108407]