A function is a standalone block of code that performs a specific task. It is not associated with any particular object or class. Functions are generally defined globally or within modules and can be called from anywhere in the program.
A method is a function that is associated with an object and is called on that object. Methods are functions that belong to a specific class and are defined within the class. They operate on the object's data and are accessed using dot notation.