title: how to edit the list of a class?
body: <p>The following program is about extending the stack to perform operations push, pop and max (find the maximum value in stack)</p>
  <pre><code>class stack:
  
      def __init__(self):
          self.stack=[]
  
      def push(self,n):
          self.stack.append(n)
  
      def pop(self):
          assert(self.stack)
          n=self.stack.pop(len(self.stack)-1)
  
      def max(self):
          new_list=self.stack
          new_list.sort()
          return new_list[-1]
  </code></pre>
  <p>In the max function, in the new_list, the list being copied also have the popped elements or the pop function is not being reflected in new_list, why is that?</p>