A function is a block of organized, reusable code/statements that is used to perform a specific, related task
More about FunctionsBasically, functions can be divided into the following two types:
Python interpreter has a number of functions available for use, which comes with Python
These functions are called built-in functions
For example, print()
function prints the given object to the standard output device (screen) or to the text stream file
Following are built-in functions of Python 3.6
Method | Description | Example | |
---|---|---|---|
abs() | returns absolute value of a number - the (positive) distance between a number and zero |
|
|
all() | returns true when all elements in iterable is true |
|
|
any() | Checks if any Element of an Iterable is True |
|
|
ascii() | Returns String Containing Printable Representation |
|
|
bin() | converts integer to binary string |
|
|
bool() | Converts a Value to Boolean |
|
|
bytearray() | returns array of given byte size |
|
|
bytes() | returns immutable bytes object |
|
|
callable() | Checks if the Object is Callable |
|
|
chr() | Returns a Character (a string) from an Integer |
|
|
classmethod() | returns class method for given function | Stack Overflow | |
compile() | Returns a Python code object |
|
|
complex() | Creates a Complex Number |
|
|
delattr() | Deletes Attribute From a class object |
|
|
dict() | Creates a Dictionary |
|
|
dir() | Tries to Return Attributes of Object |
|
|
divmod() | Returns a Tuple of Quotient and Remainder |
|
|
enumerate() | Returns an Enumerate Object |
|
|
eval() | Runs Python Code Within Program |
|
|
exec() | Executes Dynamically Created Program |
|
|
filter() | constructs iterator from elements which are true |
|
|
float() | returns floating point number from number, string |
|
|
format() | returns formatted representation of a value |
|
|
frozenset() | returns immutable frozenset object |
|
|
getattr() | returns value of named attribute of an object |
|
|
globals() | returns dictionary of current global symbol table | ||
hasattr() | returns whether object has named attribute |
|
|
hash() | returns hash value of an object | ||
help() | Invokes the built-in Help System |
|
|
hex() | Converts to Integer to Hexadecimal | ||
id() | Returns Identify of an Object |
|
|
input() | takes input from user and returns a line of string |
|
|
int() | returns integer from a number or string |
|
|
isinstance() | Checks if a Object is an Instance of Class |
|
|
issubclass() | Checks if a Object is Subclass of a Class | ||
iter() | returns iterator for an object | ||
len() | Returns Length of an Object | ||
list() Function | creates list in Python | ||
locals() | Returns dictionary of a current local symbol table | ||
map() | Applies Function and Returns a List | ||
max() | returns largest element | ||
memoryview() | returns memory view of an argument | ||
min() | returns smallest element | ||
next() | Retrieves Next Element from Iterator | ||
object() | Creates a Featureless Object | ||
oct() | converts integer to octal | ||
open() | Returns a File object | ||
ord() | returns Unicode code point for Unicode character | ||
pow() | returns x to the power of y | ||
print() | Prints the Given Object | ||
property() | returns a property attribute | ||
range() | return sequence of integers between start and stop | ||
repr() | returns printable representation of an object | ||
reversed() | returns reversed iterator of a sequence | ||
round() | rounds a floating point number to ndigits places | ||
set() | returns a Python set | ||
setattr() | sets value of an attribute of object | ||
slice() | creates a slice object specified by range() | ||
sorted() | returns sorted list from a given iterable | ||
staticmethod() | creates static method from a function | ||
str() | returns informal representation of an object | ||
sum() | Add items of an Iterable | ||
super() | Allow you to Refer Parent Class by super | ||
tuple() Function | Creates a Tuple | ||
type() | Returns Type of an Object | ||
vars() | Returns __dict__ attribute of a class | ||
zip() | Returns an Iterator of Tuples | ||
__import__() | Advanced Function Called by import |