212k views
10 votes
What is the difference between a method and a function? In what ways are they similar? Why do you think Python makes a distinction between methods and functions?

1 Answer

5 votes

Answer:

A method in python is somewhat similarto a function, except it is associated with object/classes. Methods in python are very similar to functions except for two major differences. The method is implicitly used for an object for which it is called. The method is accessible to data that is contained within the class.

User Garnet Ulrich
by
5.2k points