0% found this document useful (0 votes)
20 views2 pages

Python Inbuilt Functions Explanation

The document provides a comprehensive list of built-in functions in Python, along with brief explanations and examples for each function. Functions include abs, all, any, bin, bool, dict, eval, len, and many others, covering a wide range of functionalities. This serves as a useful reference for Python developers to understand and utilize these built-in capabilities.

Uploaded by

adwsnair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views2 pages

Python Inbuilt Functions Explanation

The document provides a comprehensive list of built-in functions in Python, along with brief explanations and examples for each function. Functions include abs, all, any, bin, bool, dict, eval, len, and many others, covering a wide range of functionalities. This serves as a useful reference for Python developers to understand and utilize these built-in capabilities.

Uploaded by

adwsnair
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

List of Inbuilt Functions in Python with Explanation

abs(x): Returns the absolute value of a number. Example: abs(-7) → 7


all(iterable): Returns True if all elements of the iterable are true. Example: all([True, True, False])
→ False
any(iterable): Returns True if any element of the iterable is true. Example: any([False, True]) →
True
ascii(object): Returns a readable version of an object, escaping non-ASCII characters.
bin(x): Converts an integer to its binary string. Example: bin(5) → '0b101'
bool(x): Converts a value to a Boolean (True or False).
bytearray([source[, encoding[, errors]]]): Returns a new array of bytes.
bytes([source[, encoding[, errors]]]): Returns a bytes object.
callable(object): Returns True if the object appears callable. Example: callable(len) → True
chr(i): Returns a string representing a character whose Unicode code point is the integer i.
Example: chr(97) → 'a'
classmethod(function): Converts a function to a class method.
compile(source, filename, mode): Compiles source into a code object.
complex(real[, imag]): Creates a complex number. Example: complex(1, 2) → (1+2j)
delattr(object, name): Deletes an attribute from an object.
dict(**kwargs): Creates a dictionary. Example: dict(a=1, b=2) → {'a':1, 'b':2}
dir([object]): Returns a list of names in the local scope or attributes of the object.
divmod(a, b): Returns a tuple (a // b, a % b). Example: divmod(9, 2) → (4, 1)
enumerate(iterable, start=0): Adds a counter to an iterable. Example: list(enumerate(['a','b'])) →
[(0,'a'),(1,'b')]
eval(expression): Evaluates a Python expression string. Example: eval('3+5') → 8
exec(object): Executes Python code dynamically.
filter(function, iterable): Filters items from iterable where function(item) is True.
float(x): Converts a number or string to a floating point number.
format(value[, format_spec]): Returns a formatted representation of value.
frozenset([iterable]): Returns an immutable frozenset object.
getattr(object, name[, default]): Returns the value of a named attribute of an object.
globals(): Returns a dictionary of the current global symbol table.
hasattr(object, name): Returns True if the object has the named attribute.
hash(object): Returns the hash value of an object.
help([object]): Invokes the built-in help system.
hex(x): Converts an integer to a hexadecimal string. Example: hex(255) → '0xff'
id(object): Returns the identity (memory address) of an object.
input([prompt]): Reads a line from input.
int(x[, base]): Converts a number or string to an integer.
isinstance(object, classinfo): Checks if an object is an instance or subclass of classinfo.
issubclass(class, classinfo): Checks if a class is a subclass of classinfo.
iter(object[, sentinel]): Returns an iterator object.
len(s): Returns the number of items in an object. Example: len('abc') → 3
list([iterable]): Creates a list from an iterable.
locals(): Returns a dictionary of the current local symbol table.
map(function, iterable): Applies a function to all items in an iterable.
max(iterable): Returns the largest item in an iterable.
min(iterable): Returns the smallest item in an iterable.
next(iterator[, default]): Returns the next item from an iterator.
object(): Returns a new featureless object.
oct(x): Converts an integer to an octal string.
open(file, mode='r'): Opens a file and returns a file object.
ord(c): Returns the Unicode code of a character.
pow(x, y[, z]): Returns (x ** y) % z if z is present, else x ** y.
print(*objects, sep=' ', end='\n'): Prints objects to the console.
property([fget[, fset[, fdel[, doc]]]]): Returns a property attribute.
range(start, stop[, step]): Generates a sequence of numbers.
repr(object): Returns a string containing a printable representation of an object.
reversed(seq): Returns a reversed iterator of a sequence.
round(number[, ndigits]): Rounds a number to ndigits precision.
set([iterable]): Creates a set object.
setattr(object, name, value): Sets an attribute value on an object.
slice(start, stop[, step]): Returns a slice object.
sorted(iterable): Returns a sorted list from the iterable.
staticmethod(function): Converts a function to a static method.
str(object=''): Returns a string version of an object.
sum(iterable): Returns the sum of all elements in an iterable.
super(): Returns a proxy object to delegate method calls to a parent class.
tuple([iterable]): Creates a tuple from an iterable.
type(object): Returns the type of an object.
vars([object]): Returns __dict__ of an object.
zip(*iterables): Aggregates elements from multiple iterables.
__import__(name): Imports a module by name.

You might also like