class definitions class serves as the primary means for abstraction in object-oriented programming in pythonevery piece of data is represented as an instance of some class class provides set of behaviors in the form of member functions (also known as methods)with implementations that are common to all instances of that class class also serves as blueprint for its instanceseffectively determining the way that state information for each instance is represented in the form of attributes (also known as fieldsinstance variablesor data membersexamplecreditcard class as first examplewe provide an implementation of creditcard class based on the design we introduced in figure of section the instances defined by the creditcard class provide simple model for traditional credit cards they have identifying information about the customerbankaccount numbercredit limitand current balance the class restricts charges that would cause card' balance to go over its spending limitbut it does not charge interest or late payments (we revisit such themes in section our code begins in code fragment and continues in code fragment the construct begins with the keywordclassfollowed by the name of the classa colonand then an indented block of code that serves as the body of the class the body includes definitions for all methods of the class these methods are defined as functionsusing techniques introduced in section yet with special parameternamed selfthat serves to identify the particular instance upon which member is invoked the self identifier in pythonthe self identifier plays key role in the context of the creditcard classthere can presumably be many different creditcard instancesand each must maintain its own balanceits own credit limitand so on thereforeeach instance stores its own instance variables to reflect its current state syntacticallyself identifies the instance upon which method is invoked for exampleassume that user of our class has variablemy cardthat identifies an instance of the creditcard class when the user calls my card get balance)identifier selfwithin the definition of the get balance methodrefers to the card known as my card by the caller the expressionself balance refers to an instance variablenamed balancestored as part of that particular credit card' state