+ 1
Can anyone tell me the difference between a method and a function?
3 Answers
+ 4
Methods are usually constructs that take arguments but return none. Functions take arguments and return values.
An example for a method would be the print "function"; one for a function would be the len(list) function.
+ 1
technically, methods are function, but defined within an object. Objects may have properties which are variables within the object or methods which are functions within. you will learn more later in OOP section
+ 1
method is the way of making a programme or can say that take arguments but do not return anything.(eg.print
it is fixed )
while functions are set of operations to do a specific taskn like ('range' tells you the range of list).