Functions vs. Methods

Let's learn the difference between functions and methods using an example.

We'll cover the following

A common misconception and source of confusion is that method and function are used interchangeably or as synonyms which is not at all correct. A method refers to a function that is part of a class and defined inside the body of the class. To access a method, we have to access an instance or object of the class using the ( . ) dot operator.

Method

Python:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy