The first “method” that we create for this class of objects is a “constructor”. This section of code is run automatically whenever and instance of “Calc() is create. The object has some variables associated with it. Total is a running total of the sums we have done so far – so we set it to zero initially. “self.current” is a string in which we hold the numbers that are being entered via the GUI. Then we have three “flags”. I’m not sure if this is the most effective way to do this, but it seems to work okay. The “new_num” flag is set to true if the calculator is expecting a new number (eg after the user has pressed “+” etc.) There’s also a flag for “op_pending” which tells if there is still a calculation to do. The flag “self.eq_flag” keeps a record of whether equals has just been pressed. I needed these flags to make the calculator work as expected. For instance, you can press “equals” when there is no operation pending, and the number will stay the same. You can press an operator after “equals” and that action will be done to the current total. Or you can start a new number after pressing equals and the previous target is discarded.