In the last post, we discovered the different python number types and how to use them for counting, or calculating things.
But Python not only gives us numbers. It also provides us with a toolbox filled with built-in functions that work beautifully with them.
Let’s walk through the ones that every beginner should know.
Convert to Numbers
Sometimes, a number looks like a number but it’s actually a string. If you’ve got “42” and want to do math with it, you’ll need to convert it first.
We use methods like int() and float() to do just that.

Round floats
Regarding floats, you can round them to the nearest whole number using the round() method

If you want more control, you can pass a second argument:

Absolute Value, Power, and Beyond
Math sometimes calls for more than just adding and subtracting.
Python can help in such cases natively.
The built-in method abs() give you the absolute value of a number.
The built-in method pow() raises a number to a power, like 2 to the 3rd power.

You can also use the ** operator for powers, but pow() has an optional third argument for modulo math (used in cryptography and algorithms).

The above is the equivalent of:

Summing, sorting and picking numbers from collections
Python loves working with collections of numbers. You don’t need a loop just to find the biggest value.

These functions work on any iterable be it lists, tuples, even ranges.
Calculating Quotient and Remainder Simultaneously. The divmod() method
The Python built-in function divmod() combines floor division and modulo division, returning first the quotient that comes from floor division, then the remainder.
Because divmod() will be working with two parameters, we need to pass two argument numbers to it. The first represents the dividend, and the second represents the divider.

This method is perfect for when you’re working with things like currency breakdowns or formatting time.
Example: Breaking Down Cents into Coins
Suppose you have 117 cents, and you want to break it down into quarters (25¢), dimes (10¢), nickels (5¢), and pennies (1¢). You can use divmod() to handle this cleanly.

And we get both the number of coins and the remainder.

For all these you just utilize the standard library
All these methods are built-in, so you don’t need to import anything. That’s part of Python’s beauty. It keeps things readable and efficient without cluttering your screen.
These methods help build complex programs by reducing code length, improving logic clarity, and guaranteeing precise results.