we can also create generator expressionwhichapart from replacing square brackets with parenthesesuses the same syntax and carries out the same operation as list comprehensions generator expressionshoweverdo not create listthey create generator object this object does not create the databut rather creates that data on demand this means that generator objects do not support sequence methods such as append(and insert(you canhoweverchange generator into list using the list(functionclasses and object programming classes are way to create new kinds of objects and they are central to object-oriented programming class defines set of attributes that are shared across instances of that class typicallyclasses are sets of functionsvariablesand properties the object-oriented paradigm is compelling because it gives us concrete way to think about and represent the core functionality of our programs by organizing our programs around objects and data rather than actions and logicwe have robust and flexible way to build complex applications the actions and logic are still present of coursebut by embodying them in objectswe have way to encapsulate functionalityallowing objects to change in very specific ways this makes our code less error-proneeasier to extend and maintainand able to model real-world objects classes are created in python using the class statement this defines set of shared attributes associated with collection of class instances class usually consists of number of methodsclass variablesand computed properties it is important to understand that defining class does notby itselfcreate any instances of that class to create an instancea variable must be assigned to class the class body consists of series of statements that execute during the class definition the functions defined inside class are called instance methods they apply some operations to the class instance by passing an instance of that class as the first argument this argument is called self by conventionbut it can be any legal identifier here is simple example