theritically, i want to know the differences
A function is a block of code that performs a specific task and is defined using def. It is independent and not tied to any object or class. A method is a function that is associated with an object or class. It is called on an object and can access or modify the object’s data