Built-in functions of Python

Python provides a list of built in functions that are of fundamental use across the Python programming environment.

 

Built-in functions in Python:

abs(num)

Provides only the magnitude without sign or the absolute part of integers, real numbers and complex numbers.

all(iterabaleObject) Checks whether all the elements of an iterable object is true.

any(iterableObject)

Checks whether any element of an iterable object is true.

ascii(object) The ascii() method returns a printable string representation of a Python object.
bin(object) Converts an integer into a binary string.
bool(object) The bool() function converts any object into a Boolean value.
bytes(source) Creates a bytes object from source and returns it. The bytes is an immutable sequence.
bytearray(source) Constructs a bytearray from source. The bytearray is a mutable sequence.
callable(object) Determines whether the object is callable. Returns a Boolean value.
chr(i) Coneverts a codepoint ie., the numeric value, of a character into a string containing the corresponding character.
classmethod(func) Makes a function into a static function.
complex(real[, imag]) Creates a complex number from a real and imaginary parts.
dict(**kwargs),
dict(mapping, **kwargs),
dict(iterable, **kwargs)

Creates a Python dictionary from keyword arguments, any mapping object and any iterable passed as parameters.

dir(object) Returns the attributes of a Python object.
enumerate() Given an iterable enumerate() creates another iterable that will return a tuple of (index, item).
filter() Given a predicate function and iterable, the function filter() returns an iterable – capable of skipping items based on the predicate function.
float() Creates a floating point number from integer, floating point and string arguments. 

hash(object)

Provides the hash value of a Python Object which is used in object comparison, storage and lookup in containers like dict, set.

hex(intVal)

The built-in python function hex(intVal) converts an integer value of decimal form, octal form into hexadecimal form

and returns a string containing the hexadecimal value.

id(object) The built-in function id() returns the unique id of a python object.
oct(intVal) The python oct() function returns the octal string corresponding to the decimal value, octal value, hexadecimal value of an integer.
sum(iterable[, start])

The sum() function in Python returns the sum of elements of an iterable, where all the elements are of type integer, floating-point or complex.

The summation starts at the index specified by the start paramter. The start parameter  which is optional has the default value of 0.

 

 

 

 

 


Copyright 2024 © pythontic.com