What is the difference between method and function in python ?
Method and Function
613
21-Jun-2018
Prakash nidhi Verma
22-Jun-2018Python Method:
A dependent object is associated by method.It may or may not return any data.A method can operate on the data as a instance variables that is contained by the corresponding class.
syntax :
Functions:
Function is block of code that is also called by its name. The function can have different parameters or may not have any at all. If any data as a parameters are passed ,It may or may not return any data.Function doesn't deal with class and its instance concept.
syntax :
Difference between method and function :
function and method both look similar. they perform in almost similar way, but the key difference is the concept of Class and Object.Functions can be called only by its name, But methods can’t be called by its name only, we need class by a reference of that class.