Built-in functions in Python - An Introduction

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.

any(iterableObject)

Checks whether any element of an iterable object is true.

all(iterableObject)

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

hash(object)

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

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.
chr(i) Coneverts a codepoint ie., the numeric value, of a character into a string containing the corresponding character.
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