Polymorphism means many form. in python there are many operators and function which have many forms.
it is useful to create different classes and having a functions with same name, that helps to re-use of of code which decrease lot of complexity in programming.
Polymorphism in operators.
+ operator calcualate addition of two number and concat two string.
print("aman" + "singh")
Polymorphism in functions
marks=[12, 34, 45, 56]
In compostion, one of the classes is composed of one or more instance of other classes, in this concept one class is like a container and other one is a content, when you delete a container object, then relatively all content objects deleted also.
When python operator have different meaning according to the context is called operator overloading.
For example + operators is used to calculate sum of two number and concat two string.
Python special functions
Function in a class beign and end with double underscore __function_name__ are called special functions.
When a method in a subclass has same name, parameters, and same return type as a super class method, the method in the sub class is called override method.
In OOP, Method overriding is an ability to allow sub class to implement specific