car volvo blue model print car listing python class constructor example lets extend the class by defining function as welld car car def init model model model color color def displaycar model print color lets using the class car "red car displaycar ( car ford green model print car car volvo blue model print car =black car displaycar (listing python class with function as you see from the code we have now defined class "carthat has class variables called "modeland "color"and in addition we have defined function (or methodcalled "displaycar()its normal to use the term "methodfor functions that are defined within class you declare class methods like normal functions with the exception that the first argument to each method is self to create instances of classyou call the class using class name and pass in whatever arguments its init (method accepts for example