Built-in Functions
print(object = ‘’, end = "\n")
objectto stdout followed by
end.
input([prompt])
If the
promptargument 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.
assert(expression, message = ‘’)
Raise AssertionError if
expressionevaluates to false.
exit(message = N)
Terminates the calling process. When
messageis specified it is printed to stderr.
sleep(secs)
Suspend execution of the calling thread for the given number of seconds. The argument may be a floating point number to indicate a more precise sleep time.
swap(&a, &b)
Exchanges the values of the two arguments. Equivalent to
(a, b) = (b, a).
zip(iterable1, iterable2 [,iterable3])
Aggregates elements from input iterables.
all(iterable)
Return true (1B) if all elements of the
iterableare true (or if the
iterableis empty).
any(iterable)
Return true (1B) if any element of the
iterableis true. If the
iterableis empty, return false (0B).
cart_product(iterable1, iterable2 [,iterable3])
Cartesian product of input iterables.
multiloop(iterable1, iterable2 [,iterable3], function)
This function is roughly equivalent to the following code: {…}
multiloop_filtered(iterable1, iterable2 [,iterable3], filter_function, function)
This function is roughly equivalent to the following code: {…}
sum(iterable)
Sums the items of an
iterableand returns the total.
product(iterable)
Multiplies the items of an
iterableand returns the total.
sorted(iterable, key = N, reverse = 0B)
Return a new sorted array from the items in
iterable.
keyspecifies a function of one argument that is used to extract a comparison key from each element of
iterable.
reverseis a boolean value. If set to true (1B), then the elements of
iterableare sorted as if each comparison were reversed.
min(arg1, arg2)
Return the smallest of two arguments.
min(iterable)
Return the smallest item of
iterable.
max(arg1, arg2)
Return the largest of two arguments.
max(iterable)
Return the largest item of
iterable.
hex(x)
Convert an integer number to an uppercase hexadecimal string.
bin(x)
Convert an integer number to a binary string.
rotl(value, shift)
Rotate the
valueleft by
shiftbits.
rotr(value, shift)
Rotate the
valueright by
shiftbits.
Mathematical functions