Operations that can be performed in Python / Inbuilt functions in Python / Python Documentation n

The first place to see what Python is capable of out of the box is to familiarize yourself with the Documentation.

What is the Python documentation?

Thedocumentationexplains how a softwareoperates or how to use it.

If you are a beginner this will make little sense but as you progress, your understanding should increase. I would advise regularly going back to the documentation.

A good way to read about a function in Python is to google:library nametutorial

Functions in Python

All inbuilt functions in Pythonhttps://docs.python.org/3/library/functions.html

Credit:https://www.programiz.com/python-programming/methods/built-in

Name Description Code Related to
abs() Returns the absolute value of a number

Python

print(abs(-5))

Output

5
 
all() Returns false if there is a false or a zero in a list,tuple or dictionary

Python

print(all([0,1,1]))

Output

False
 
any()

Returns True if there is a True in a list,tuple or dictionary

*The opposite of all()

Python

print(all([True, False, False]))

Output

True
 
ascii() Returns any non-ascii characters with escape characters

Python

print(ascii("å"))

Output

\e5
 
bin() Returns the binary version of an integer

Python

print(bin(50))

Output

0b110010
 
bool()

Returns true unless

The object is empty, like [], (), {}
The object is False
The object is 0
The object is None

Python

print(bool(50))

Output

true
 
callable() Returns true if a function is callable or false if a function is not callable 

Python

def x():   
a = 5
print(callable(x)) 

Output

true
 
chr() Returns the character that represents the specified unicode

Python 

print(chr(97))

Output

 
delattr() Function to delete a specified attribute from a specified object     
dict() Creates a dictionary    
dir() Returns a list of valid attributes of an object     
divmod() Returns a pair of numbers; the first is the quotient, the second is a remainder 

Python

print(divmod(8, 3))

Output 

(2,2)

3 goes into 8 two times with two remaining therefore (2,2)

 
enumerate() Returns an enumerate object along with an iterate 

Python

grocery = ['bread', 'milk', 'butter']
enumerateGrocery = enumerate(grocery)
print(list(enumerateGrocery))

Output

[(0, 'bread'), (1, 'milk'), (2, 'butter')]
 
filter() Filters the given iterable with the help of a function that tests each element in the iterable to be true or not.

Python

# list of alphabets
alphabets = ['a', 'b', 'd', 'e']
# function that filters vowels
def filterVowels(alphabet):
    vowels = ['a', 'e', 'i', 'o', 'u']
    if(alphabet in vowels):
        return True
    else:
        return False
filteredVowels = filter(filterVowels, alphabets)
for vowel in filteredVowels:
    print(vowel)

Output

a
e
 
eval() Returns the result of an expression 

Python

x = 1
print(eval('x + 1'))

Output

2
 
float() Returns a floating point number     
frozenset() returns an immutable frozenset object initialized with elements from the given iterable    
format() Returns a formatted representation of the given value controlled by the format specifier.    
getattr() returns the value of the named attribute of an object. If not found, it returns the default value provided to the function OOP    
globals() returns the dictionary of the current global symbol table    
exec() executes the dynamically created program, which is either a string or a code object    
hasattr() returns true if an object has the given named attribute and false if it does not OOP    
help() calls the built-in Python help system    
hex() converts an integer number to the corresponding hexadecimal string    
hash() returns the hash value of an object if it has one    
input() * Reads a line from input, converts into a string and returns it    
id() turns identity (unique integer) of an object.    
isinstance() checks if the object (first argument) is an instance or subclass of classinfo class (second argument)    OOP
int()* turns an integer object from any number or string    
issubclass() checks if the object argument (first argument) is a subclass of classinfo class (second argument). OOP    
iter() returns an iterator for the given object    
list() returns a list in Python.    
locals() returns a dictionary of the current local symbol table.    
len() returns the number of items (length) in an object.    
max() returns the largest item in an iterable. It can also be used to find the largest item between two or more parameters.    
min() returns the smallest item in an iterable. It can also be used to find the smallest item between two or more parameters.    
map() applies a given function to each item of an iterable (list, tuple etc.) and returns a list of the results.    
memoryview() returns a memory view object of the given argument.returns a memory view object of the given argument.    
next() returns the next item from the iterator.    
object() returns a featureless object which is a base for all classes OOP    
oct() takes an integer number and returns its octal representation.    
ord() returns an integer representing the Unicode character.    
open() opens the file (if possible) and returns the corresponding file object.    
pow() returns the power of a number.    
print()* prints the given object to the standard output device (screen) or to the text stream file.    
property() returns the property attribute.   OOP
range() returns an immutable sequence of numbers between the given start integer to the stop integer.    
repr() Returns a printable representation of the given object.    
reversed() returns the reversed iterator of the given sequence.    
round() returns a floating-point number rounded to the specified number of decimals.    
set()* builtin creates a Python set from the given iterable.    
setattr() sets the value of the attribute of an object.    OOP
slice() returns a slice object that can use used to slice strings, lists, tuple etc.    
sorted() returns a sorted list from the items in an iterable.    
str()* returns the string version of the given object.    
sum() adds the items of an iterable and returns the sum.    
tuple()* can be used to create tuples in Python.    
type() returns the type of the object or returns a new type object based on the arguments passed.    OOP
vars() returns the __dict__ attribute of the given object.    
zip() Takes iterables (can be zero or more), aggregates them in a tuple, and return it.    
breakpoint()      
super()