Posts

Showing posts with the label Types of Functions

Python3 Types of functions

Python  Functions Types of Functions:        1.  Built-in Functions        2.  User-defined Functions   Built-in Functions : 1 . abs()         #find the absolute value        num=-100        print(abs(num))   output: 100 2 . all()   #return value of all() function   True : if all elements in an iterable are true   False : if any element in an iterable is false Eg:        lst=[1,2,3,4]        print(all(lst))               lst1=[0,2,3,4]        print(all(lst1)) output: True               False           lst=[ ]        print(all(lst))           lst1=[False,1,2]      #False present in a list, then all(lst) is also False        print(all(lst1)) output:  True                False   3 . dir()   The dir() tries to return a list of valid attributes of the object.   If the object has dir() method, the method will be called and must return the list of attributes.   If the object doesn't have dir() method, the method tries to find information from the dict attribute (if defined) ,and from ty