title: implementing a circular queue in python - a level standard
body: <p>i am trying to implement a circular queue in python and my current program keeps giving me error, and I would like to know the problem and solve it.</p>
  
  <p>my current program is :</p>
  
  <pre><code># circular queue
  
  class circularQueue:
     def __init__(self, maxsize):
          self.front = 0
          self.rear = -1
          self.queue = []
          self.size = 0 # elements in the queue
          self.maxsize = maxsize #size of the array(queue)
  
     def isEmpty(self):
         if self.size == 0:
              return True
         else:
             return False
  
     def isFull(self):
         if self.size == self.maxsize:
            return True
         else:
            return False
  
     def enQueue(self, newItem):
         if self.size == self.maxsize:
             print('Queue Full')
         else:
             self.rear = (self.rear + 1) % self.maxsize # mod = remainder
             self.queue[self.rear] = newItem
             self.size += self.size
  
     def deQueue(self):
         if self.size == 0:
             print('Queue Empty')
             item = null
         else:
             item = self.queue[self.front]
             self.front = (self.front + 1) % self.maxsize
             self.size = self.size - 1
  
         return item
  </code></pre>
  
  <p>and if i try to operate </p>
  
  <pre><code>q = circularQueue(6)
  q.enQueue('k')
  </code></pre>
  
  <p>it says </p>
  
  <pre><code>self.queue[self.rear] = newItem
  IndexError: list assignment index out of range
  </code></pre>
  
  <p>Please help me ...... </p>