Python exec() FunctionThe python exec() function is used for the dynamic execution of Python program which can either be a string or object code and it accepts large blocks of code, unlike the eval() function which only accepts a single expression.Signatureexec(object, globals, locals)Parametersobject - It should be either string or...
Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
11 April, 2022
Python compile() Function
Programing Coderfunda
April 11, 2022
Python
No comments
Python compile() FunctionThe python compile() function takes source code as input and returns a code object which can later be executed by exec() function.Signaturecompile(source, filename, mode, flag, dont_inherit, optimize)Parameterssource - normal string, a byte string, or an AST (Abstract Syntax Trees) object.filename - File...
Python callable() Function
Programing Coderfunda
April 11, 2022
Python
No comments
Python callable() FunctionA python callable() function in Python is something that can be called. This built-in function checks and returns True if the object passed appears to be callable, otherwise False.Signaturecallable(object)Parametersobject - The object that you want to test and check, it is callable or not.ReturnReturns True...
Python bytes() Function
Programing Coderfunda
April 11, 2022
Python
No comments
Python bytes() FunctionThe python bytes() function in Python is used for returning a bytes object. It is an immutable version of bytearray() function.It can create empty bytes object of the specified size.Signaturebytes(source)bytes(encoding)bytes(error)Parameterssource is used to initialize the bytes object. It is an optional...
Python bool() Function
Programing Coderfunda
April 11, 2022
Python
No comments
Python bool() FunctionThe python bool() method converts value to boolean (True or False) using the standard truth testing procedure.Signaturebool([value]) ParametersIt is not mandatory to pass value to bool(). If you do not pass the value, bool() returns False.In general , bool() takes a single parameter value.ReturnThe bool()...
Python bin() Function
Programing Coderfunda
April 11, 2022
Python
No comments
Python bin() FunctionThe python bin() function is used to return the binary representation of a specified integer. A result always starts with the prefix 0b.Signaturebin(n)Parametersn - An integerReturnIt returns the binary representation of a specified integer.Python bin() Function Example 1x = 10 y = bin(x) print (y) Output:0b1010
Note:...
Python all() Function
Programing Coderfunda
April 11, 2022
Python
No comments
Python all() FunctionThe python all() function accepts an iterable object (such as list,dictionary etc.). It returns True if all items in passed iterable are true, otherwise it returns False. If the iterable object is empty, the all() function returns True.Signatureall (iterable) Parametersiterable - The objects which...