Python - What is the difference between functions and methods in Python

Опубликовано: 01 Апрель 2026
на канале: Endezyaro
129
2

Python Tutorial for beginners 12
This video focuses on the difference between functions and methods in Python.

the following built-in functions were used as examples:
sorted(): It is funciton because it is independent and it returns a new sorted list from the items in iterable.
max(): It returns the largest item in an iterable.
isinstance(object, classinfo): It returns True if the object argument is an instance of the classinfo.

the following built-in methods were used as examples:
A method is called by its name, but it is associated to an object an independent.
myUnsortedList.sort(): It is a method, because it is dependent, because it depends on the created object named in this case 'myUnsortedList'.
count(): It is a method, it returns number of occurrences of value.

enjoy watching and learning :-)