Predeclared in Python §1

Constants

(constant) False :bool

The false value of the bool type.
Type:
  • bool

(constant) None :NoneType

An object frequently used to represent the absence of a value. See also Python 3.13 Documentation.
Type:
  • NoneType

(constant) True :bool

The true value of the bool type.
Type:
  • bool

(constant) math_e :float

The Number value for e, Euler's number, which is approximately 2.718281828459045.
Type:
  • float

(constant) math_inf :float

The name inf refers to float value positive infinity. (For negative infinity, use -math.inf.) Equivalent to the output of float('inf'). See also Python 3.13 Documentation.
Type:
  • float

(constant) math_nan :float

A floating-point “not a number” (nan) value. Equivalent to the output of float('nan'). See also Python 3.13 Documentation.
Type:
  • float

(constant) math_pi :float

The float value of π, the ratio of the circumference of a circle to its diameter, which is approximately 3.1415926535897932.
Type:
  • float

(constant) math_tau :float

Tau is a circle constant equals to , the ratio of a circle’s circumference to its radius, which is approximately 6.283185307179586.
Type:
  • float

Functions

_int(number) → {int}

Return an integer object constructed from a number, or return 0 if no arguments are given.
Parameters:
Name Type Description
number int | float The numeric value from which to construct the integer. If provided, it is converted to an integer by truncating toward 0. If omitted, it defaults to 0.
Returns:
an integer object constructed from the given number
Type
int

_int_from_string(string, base) → {int}

Return an integer object constructed from a string. If base is given, the string is parsed as an integer in radix base. The string may include optional whitespace, a leading sign (+ or -), and underscores between digits.
Parameters:
Name Type Description
string string A string representing an integer in a given base. The string may include optional whitespace, a leading sign, and underscores between digits.
base int The base (radix) for conversion. It must be 0 or an integer in the range 236. The default is 10.
Returns:
an integer object parsed from the provided string using the specified base
Type
int

abs(x) → {int|float|complex}

Return the absolute value of x. For an int input, it returns the non-negative integer equivalent. For a float input, it returns the positive floating-point number representing its magnitude. For a complex input, it computes and returns the modulus (the square root of the sum of the squares of the real and imaginary parts) as a float.
Parameters:
Name Type Description
x int | float | complex The number whose absolute value is computed.
Returns:
the absolute value of x
Type
int | float | complex

char_at(s, i) → {string}

Takes a string s as the first argument and a nonnegative integer i as the second argument. If i is less than the length of s, this function returns a one-character string that contains the character of s at position i, counting from 0. If i is larger than or equal to the length of s, this function returns None.
Parameters:
Name Type Description
s string the given string
i int the index
Returns:
one-character string or None
Type
string

error(*object) → {NoneType}

Prints the provided *object arguments to the standard output (similar to a simplified print) and then raises an exception. This function accepts a variable number of arguments, converts them to their string representations using str(), outputs them (with a newline) just like what print does, and immediately halts execution by raising an exception.
Parameters:
Name Type Description
*object any Objects to be printed to the standard output
Returns:
the None value
Type
NoneType

input(prompt) → {string}

If the prompt argument is present, it is written to standard output without a trailing newline. The function then reads a line from input, converts it to a string (stripping a trailing newline), and returns that.
Parameters:
Name Type Description
prompt string An optional string that is written to standard output (without a trailing newline) before input is read.
Returns:
the input read from the user as a string, with any trailing newline removed
Type
string

isinstance(object, classinfo) → {bool}

Return True if object is an instance of classinfo. classinfo can be None, int, float, string, bool, and complex.
Parameters:
Name Type Description
object any The object to be checked, i.e. the one to determine whether it is an instance of the specified type.
classinfo string The name of a single class (type). The type information used to test the object's type.
Returns:
indicating whether object is an instance of classinfo
Type
bool

math_acos(x) → {float}

Return the arc cosine of x, in radians. The result is between 0 and pi.
Parameters:
Name Type Description
x int | float The value whose arc cosine is to be computed. Must be in the interval [-1, 1].
Returns:
the arc cosine of x in radians
Type
float

math_acosh(x) → {float}

Return the inverse hyperbolic cosine of x.
Parameters:
Name Type Description
x int | float The number for which to compute the inverse hyperbolic cosine. (Typically, x must be ≥ 1.)
Returns:
the inverse hyperbolic cosine of x
Type
float

math_asin(x) → {float}

Return the arc sine of x, in radians. The result is between -pi/2 and pi/2.
Parameters:
Name Type Description
x int | float The value whose arc sine is to be computed. Must be in the interval [-1, 1].
Returns:
the arc sine of x in radians
Type
float

math_asinh(x) → {float}

Return the inverse hyperbolic sine of x.
Parameters:
Name Type Description
x int | float The number for which to compute the inverse hyperbolic sine.
Returns:
the inverse hyperbolic sine of x
Type
float

math_atan(x) → {float}

Return the arc tangent of x, in radians. The result is between -pi/2 and pi/2.
Parameters:
Name Type Description
x int | float The value whose arc tangent is to be computed.
Returns:
the arc tangent of x in radians
Type
float

math_atan2(y, x) → {float}

Return atan(y / x), in radians.
Parameters:
Name Type Description
y int | float The y-coordinate of the point.
x int | float The x-coordinate of the point.
Returns:
the arc tangent of y/x in radians
Type
float

math_atanh(x) → {float}

Return the inverse hyperbolic tangent of x.
Parameters:
Name Type Description
x int | float The number for which to compute the inverse hyperbolic tangent. (Must be in the interval (-1, 1).)
Returns:
the inverse hyperbolic tangent of x
Type
float

math_cbrt(x) → {float}

Return the cube root of x.
Parameters:
Name Type Description
x int | float The numeric value for which to compute the cube root.
Returns:
the cube root of x
Type
float

math_ceil(x) → {int}

Return the ceiling of x, the smallest integer greater than or equal to x.
Parameters:
Name Type Description
x int | float The numeric value for which to compute the ceiling.
Returns:
the ceiling of x
Type
int

math_comb(n, k) → {int}

Return the number of ways to choose k items from n items without repetition and without order. Returns zero when k > n.
Parameters:
Name Type Description
n int Total number of items (must be a non-negative integer).
k int Number of items to choose (must be a non-negative integer).
Returns:
the binomial coefficient of n and k
Type
int

math_copysign(x, y) → {float}

Return a float with the magnitude (absolute value) of x but the sign of y.
Parameters:
Name Type Description
x int | float The value whose magnitude (absolute value) will be used.
y int | float The value whose sign will be applied to x's magnitude.
Returns:
a float with the absolute value of x but with the sign of y
Type
float

math_cos(x) → {float}

Return the cosine of x radians.
Parameters:
Name Type Description
x int | float The angle in radians for which the cosine is computed.
Returns:
the cosine of x
Type
float

math_cosh(x) → {float}

Return the hyperbolic cosine of x.
Parameters:
Name Type Description
x int | float The angle in radians for which to compute cosh(x).
Returns:
the hyperbolic cosine of x
Type
float

math_degrees(x) → {float}

Convert angle x from radians to degrees.
Parameters:
Name Type Description
x int | float The angle in radians to be converted to degrees.
Returns:
the angle, in degrees, corresponding to the given radians
Type
float

math_erf(x) → {float}

Return the error function at x.
Parameters:
Name Type Description
x int | float The value at which to evaluate the error function.
Returns:
the error function value at x
Type
float

math_erfc(x) → {float}

Return the complementary error function at x. The complementary error function is defined as 1.0 - erf(x). It is used for large values of x where a subtraction from one would cause a loss of significance.
Parameters:
Name Type Description
x int | float The value at which to evaluate the complementary error function.
Returns:
the complementary error function at x
Type
float

math_exp(x) → {float}

Return e raised to the power x, where e = 2.718281… is the base of natural logarithms.
Parameters:
Name Type Description
x int | float The exponent for which to compute e^x.
Returns:
the value of e raised to the power x with high accuracy
Type
float

math_exp2(x) → {float}

Return 2 raised to the power x.
Parameters:
Name Type Description
x int | float The exponent for which to compute 2^x.
Returns:
the value of 2 raised to the power x with high accuracy
Type
float

math_expm1(x) → {float}

Return e raised to the power x, minus 1. Here e is the base of natural logarithms. For small x, the subtraction in exp(x) - 1 can result in a significant loss of precision; the expm1() function provides a way to compute this quantity to full precision.
Parameters:
Name Type Description
x int | float The exponent for which to compute e^x.
Returns:
the value of e raised to the power x minus 1 with high accuracy
Type
float

math_fabs(x) → {float}

Return the absolute value of a number as a float. Unlike the built-in abs(), math_fabs() always returns a float, even when the input is an integer. It only accepts int or float types (complex numbers are not supported).
Parameters:
Name Type Description
x int | float The number whose absolute value is computed.
Returns:
absolute value of x
Type
float

math_factorial(n) → {int}

Return n factorial as an integer.
Parameters:
Name Type Description
n int A non-negative integer whose factorial is to be computed.
Returns:
the factorial of n
Type
int

math_floor(x) → {int}

Return the floor of x, the largest integer less than or equal to x.
Parameters:
Name Type Description
x int | float The numeric value for which to compute the flooring.
Returns:
the flooring of x
Type
int

math_fma(x, y, z) → {float}

Fused multiply–add operation. Return (x * y) + z, computed as though with infinite precision and range followed by a single round to the float format. This operation often provides better accuracy than the direct expression (x * y) + z. This function follows the specification of the (fusedMultiplyAdd) operation described in the IEEE 754 standard. The standard leaves one case implementation-defined, namely the result of fma(0, inf, nan) and fma(inf, 0, nan). In these cases, math.fma returns a math.nan, and does not raise any exception.
Parameters:
Name Type Description
x int | float The first multiplicand. It is multiplied by y.
y int | float The second multiplicand. It is multiplied by x.
z int | float The addend. The product of x and y is added to z using a fused multiply–add operation.
Returns:
the float value of (x * y) + z
Type
float

math_fmod(x, y) → {float}

Return the floating-point remainder of x / y, as defined by the platform C library function fmod(x, y). The sign of the result is the same as the sign of x.
Parameters:
Name Type Description
x int | float The dividend. It will be converted to a float if necessary.
y int | float The divisor. It will be converted to a float if necessary.
Returns:
the platform C library function fmod(x, y) style remainder of x divided by y
Type
float

math_gamma(x) → {float}

Return the Gamma function at x.
Parameters:
Name Type Description
x int | float The input value at which the Gamma function is computed.
Returns:
the Gamma function at x
Type
float

math_gcd(*integers) → {int}

Return the greatest common divisor of the specified *integers arguments. If any of the arguments is nonzero, then the returned value is the largest positive integer that is a divisor of all arguments. If all arguments are 0, then the returned value is 0. gcd() without arguments returns 0. If any of the provided integers is negative, the function treats it as its absolute value when computing the GCD.
Parameters:
Name Type Description
*integers int A variable number of integer arguments for which to compute the greatest common divisor.
Returns:
the greatest common divisor of the given integers as a positive integer
Type
int

math_isfinite(x) → {bool}

Return True if x is neither an infinity nor a nan, and False otherwise.
Parameters:
Name Type Description
x int | float A numeric value. It is converted to float if necessary.
Returns:
the True if x is finite; otherwise, False
Type
bool

math_isinf(x) → {bool}

Return True if x is a positive or negative infinity, and False otherwise.
Parameters:
Name Type Description
x int | float A numeric value. It is converted to float if necessary.
Returns:
the True if x is an infinity (positive or negative); otherwise, False
Type
bool

math_isnan(x) → {bool}

Return True if x is a nan (not a number), and False otherwise.
Parameters:
Name Type Description
x int | float A numeric value. It is converted to float if necessary.
Returns:
the True if x is nan; otherwise, False
Type
bool

math_isqrt(n) → {int}

Return the integer square root of the non-negative n.
Parameters:
Name Type Description
n int A non-negative integer for which to compute the integer square root.
Returns:
the integer square root of n
Type
int

math_lcm(*integers) → {int}

Return the least common multiple of the specified integer arguments. If all arguments are nonzero, then the returned value is the smallest positive integer that is a multiple of all arguments. If any of the arguments is 0, then the returned value is 0. lcm() without arguments returns 1. If any of the input integers is negative, math_lcm() treats it as its absolute value when computing the LCM, so the result is always non-negative.
Parameters:
Name Type Description
*integers int A variable number of integer arguments for which the least common multiple is computed.
Returns:
the least common multiple of the given integers as a positive integer
Type
int

math_ldexp(x, i) → {float}

Return x * (2**i). This is essentially the inverse of function frexp().
Parameters:
Name Type Description
x int | float A numeric value (the significand). It is converted to float if necessary.
i int An integer exponent.
Returns:
the result of x multiplied by 2 raised to the power i
Type
float

math_lgamma(x) → {float}

Return the natural logarithm of the absolute value of the Gamma function at x.
Parameters:
Name Type Description
x int | float The input value for which to compute the natural logarithm of the absolute Gamma function.
Returns:
the natural logarithm of the absolute value of the Gamma function at x
Type
float

math_log(x, base(optional)) → {float}

With one argument, return the natural logarithm of x (to base e). With two arguments, return the logarithm of x to the given base, calculated as log(x)/log(base).
Parameters:
Name Type Description
x int | float The numeric value for which to compute the logarithm.
base(optional) int | float The base of the logarithm. If provided, the result is computed as log(x)/log(base). If omitted, the natural logarithm (base e) is returned.
Returns:
a float representing the logarithm of x (either natural logarithm when base is not provided, or logarithm with the given base otherwise)
Type
float

math_log10(x) → {float}

Return the base-10 logarithm of x. This is usually more accurate than log(x, 10).
Parameters:
Name Type Description
x int | float A positive number. The function returns the logarithm of x to base 10.
Returns:
the base-10 logarithm of x
Type
float

math_log1p(x) → {float}

Return the natural logarithm of 1+x (base e). The result is calculated in a way which is accurate for x near 0.
Parameters:
Name Type Description
x int | float The number to be added to 1. The function returns the natural logarithm of (1+x), computed in a way that is accurate for values of x near 0.
Returns:
the natural logarithm of 1+x (base e)
Type
float

math_log2(x) → {float}

Return the base-2 logarithm of x. This is usually more accurate than log(x, 2).
Parameters:
Name Type Description
x int | float A positive number. The function returns the logarithm of x to base 2.
Returns:
the base-2 logarithm of x
Type
float

math_nextafter(x, y, steps) → {float}

Return the floating-point value steps steps after x towards y. If x is equal to y, return y, unless steps is 0.
Parameters:
Name Type Description
x int | float The starting floating-point number from which the stepping begins.
y int | float The target value that determines the direction. The function will return a value toward y from x.
steps int The number of representable floating-point values to step from x toward y (default is 1).
Returns:
the floating-point number that is exactly steps representable numbers away from x in the direction of y
Type
float

math_perm(n, k) → {int}

Return the number of ways to choose k items from n items without repetition and with order. Returns zero when k > n.
Parameters:
Name Type Description
n int Total number of items (must be a non-negative integer).
k int Number of items to choose (must be a non-negative integer).
Returns:
the permutations of n and k
Type
int

math_pow(x, y) → {float}

Return x raised to the power y. Unlike the built-in ** operator, math_pow() converts both its arguments to type float.
Parameters:
Name Type Description
x int | float The base value. Both x and y are converted to float before the operation.
y int | float The exponent value. The function computes x raised to the power y, following IEEE 754 rules for special cases.
Returns:
the value of x raised to the power y
Type
float

math_radians(x) → {float}

Convert angle x from degrees to radians.
Parameters:
Name Type Description
x int | float The angle in degrees to be converted to radians.
Returns:
the angle, in radians, corresponding to the given degrees
Type
float

math_remainder(x, y) → {float}

Return the IEEE 754-style remainder of x with respect to y. For finite x and finite nonzero y, this is the difference x - n*y, where n is the closest integer to the exact value of the quotient x / y. If x / y is exactly halfway between two consecutive integers, the nearest even integer is used for n. The remainder r = remainder(x, y) thus always satisfies abs(r) <= 0.5 * abs(y).
Parameters:
Name Type Description
x int | float The dividend. It will be converted to a float if necessary.
y int | float The divisor. It will be converted to a float if necessary.
Returns:
the IEEE 754-style remainder of x divided by y
Type
float

math_sin(x) → {float}

Return the sine of x radians.
Parameters:
Name Type Description
x int | float The angle in radians for which the sine is computed.
Returns:
the sine of x
Type
float

math_sinh(x) → {float}

Return the hyperbolic sine of x.
Parameters:
Name Type Description
x int | float The angle in radians for which to compute sinh(x).
Returns:
the hyperbolic sine of x
Type
float

math_sqrt(x) → {float}

Return the square root of x.
Parameters:
Name Type Description
x int | float A non-negative number. x is converted to a float if necessary.
Returns:
the square root of x
Type
float

math_tan(x) → {float}

Return the tangent of x radians.
Parameters:
Name Type Description
x int | float The angle in radians for which the tangent is computed.
Returns:
the tangent of x
Type
float

math_tanh(x) → {float}

Return the hyperbolic tangent of x.
Parameters:
Name Type Description
x int | float The angle in radians for which to compute tanh(x).
Returns:
the hyperbolic tangent of x
Type
float

math_trunc(x) → {int}

Return x with the fractional part removed, leaving the integer part. trunc() is equivalent to floor() for positive x, and equivalent to ceil() for negative x.
Parameters:
Name Type Description
x int | float The numeric value from which the fractional part is removed, returning the integral part (i.e. x rounded toward 0).
Returns:
the integer part of x
Type
int

math_ulp(x) → {float}

Return the value of the least significant bit of the float x. If x is a NaN (not a number), return x. If x is negative, return ulp(-x). If x is a positive infinity, return x. If x is equal to 0, return the smallest positive denormalized representable float (smaller than the minimum positive normalized float, sys.float_info.min, approximately 1.7976931348623157e+308). If x is equal to the largest positive representable float, return the value of the least significant bit of x, such that the first float smaller than x is x - ulp(x). Otherwise (when x is a positive finite number), return the value of the least significant bit of x, such that the first float bigger than x is x + ulp(x).
Parameters:
Name Type Description
x int | float The numeric value (typically a float) for which to compute the ULP (Unit in the Last Place). The function returns the value of the least significant bit of x, handling special cases (NaN, infinities, 0, etc.) as specified by IEEE 754.
Returns:
the spacing between x and the next representable float in the direction defined by x's sign
Type
float

max(arg1, arg2, *args) → {int|float|string}

Returns the largest of the provided values. If multiple items are equal to the maximum, the first encountered is returned. All values should be mutually comparable.
Parameters:
Name Type Description
arg1 int | float | string The first item to compare.
arg2 int | float | string The second item to compare.
*args int | float | string Additional items to compare.
Returns:
the largest of the provided values
Type
int | float | string

min(arg1, arg2, *args) → {int|float|string}

Returns the smallest of the provided values. If multiple items are equal to the minimum, the first encountered is returned. All values should be mutually comparable.
Parameters:
Name Type Description
arg1 int | float | string The first item to compare.
arg2 int | float | string The second item to compare.
*args int | float | string Additional items to compare.
Returns:
the smallest of the provided values
Type
int | float | string

print(*object) → {NoneType}

A simplified version of the Python built-in print function. This function takes any number of parameters *object, converts them to their string representations using str(), and writes them to the standard output (sys.stdout), followed by a newline character. See the official Python documentation for print.
Parameters:
Name Type Description
*object any object(s) to be printed to the standard output
Returns:
the None value
Type
NoneType

random_random() → {float}

Return the next random floating-point number in the range 0.0 ≤ X < 1.0.
Returns:
the next random floating-point number in the range 0.0 ≤ X < 1.0
Type
float

round(number, ndigits) → {float}

Return number rounded to ndigits precision after the decimal point. If ndigits is omitted or is None, it returns the nearest integer to its input.
Parameters:
Name Type Description
number int | float The value to be rounded.
ndigits int The number of digits to round to after the decimal point. If omitted or None, the function rounds to the nearest integer.
Returns:
the number rounded to ndigits precision
Type
float

str(object) → {string}

Return a string version of object. If object is not provided, returns the empty string.
Parameters:
Name Type Description
object any The object to be converted to a string. If not provided, an empty string is returned.
Returns:
the informal string representation of object
Type
string

time_time() → {float}

Return the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.
Returns:
current time in milliseconds
Type
float