Integers (int) : are whole numbers (positive, negative or zero) without any decimal point. For example, 5, -10, and 0 are all integers in Python.
Floating-point numbers (float) : represent real numbers with decimal points or scientific notation. For example, 3.14, 2.0, and -0.1 are all floating-point numbers in Python.
Complex numbers (complex) : are numbers that have a real part and an imaginary part, both represented as floating-point numbers. Complex numbers are represented in Python using the j suffix, for example, 3 + 4j is a complex number with a real part of 3 and an imaginary part of 4.
Function | Explanation |
---|---|
abs(x) | Returns the absolute value of a number. |
pow(x, y) | Returns the value of x to the power of y. |
round(x, n) | Rounds a number to n decimal places. |
max(iterable) | Returns the largest item in an iterable or the largest of two or more arguments. |
min(iterable) | Returns the smallest item in an iterable or the smallest of two or more arguments. |
sum(iterable) | Returns the sum of all items in an iterable. |
int(x) | Converts x to an integer. |
float(x) | Converts x to a floating-point number. |
complex(real, imag) | Returns a complex number with the value real + imag*j. |
divmod(x, y) | Returns the quotient and remainder of x divided by y. |
hex(x) | Converts an integer to a lowercase hexadecimal string. |
oct(x) | Converts an integer to an octal string. |
bin(x) | Converts an integer to a binary string. |
abs() | Returns the absolute value of a number. |
pow() | Returns the value of x to the power of y. |
round() | Rounds a number to the nearest integer. |
floor() | Returns the largest integer less than or equal to a number. |
ceil() | Returns the smallest integer greater than or equal to a number. |
sqrt() | Returns the square root of a number. |
log() | Returns the natural logarithm of a number. |
log10() | Returns the base-10 logarithm of a number. |
exp() | Returns e raised to the power of x. |