Method

A method is code that defines the run time behavior of objects.

Python Example

In Python, a method is part of a defined class, whereas a function is not.
Python includes both methods and functions.

# Define a class.
class MyClass:
 
    # Define a class method.
    def my_method(self):
        print('my_method')

# Instantiate the class and use the class method.
my_class = MyClass( )
my_class.my_method( )