classes the function is defined to taking one argument and also using two two local variables and that are defined outside the function before it is called howeverlooking at this code in more detail can raise questions calling dfdx( implies that derivative __call__ is calledbut how can this methods know the values of and when it calls our (xfunctionthese variables are defined inside the test function and are therefore localwhereas the class is defined in the main program the answer is that function defined inside another function "remembers,or has access toall the local variables of the function where it is defined thereforeall the variables defined inside test_derivative become part of the namespace of the function fand can access and in test_derivative even when it is called from the __call__ method in class derivative this construction is known as closure in computer science examplea polynomial class as summarizing example of classes and special methodswe can consider the representation of polynomials introduced in polynomial can be specified by dictionary or list representing its coefficients and powers for example is and the coefficients can be stored as list [ - we now want to create class for such polynomial and equip it with functionality to evaluate and print polynomials and to add two polynomials intended use of the class polynomial could look like the followingp polynomial([ - ]print( polynomial([ - - ] print( coeff[ - - print( * ^ ^ print( ( )- * differentiate(print( * ^ * ^ to make all these operations possiblethe class needs the following special methods