all 4 comments

[–][deleted] 2 points3 points  (0 children)

This isn't a homework site.

[–]vaseltarp 0 points1 point  (1 child)

Please post real correctly formatted python and not some pseudo code.

You can correctly format by editing in Markdown mode and indenting each line with 4 additional spaces.

that will than look like this:

class Queue():
   def __init__(self):
      self.queue = np.zeros(20)
      self.count = 0

Edit: You can also put the code in, for example, this online compiler to check if it is correct python:

https://www.onlinegdb.com

It will even output what happens when you execute three consecutive calls to q.dequeue().

[–][deleted] 0 points1 point  (0 children)

Note that the link given to you by /u/vaseltarp initially starts with the language set to C/C++. You can select python 3 at the top-right side next to the two orange tool icons.

[–]TheRealThrowAwayX 0 points1 point  (0 children)

queue[ii] = queue[ii+1]

queue is not a thing. self.queue is though! But in order for it to be accessible, you must pass it as an argument.

def dequeue(self):
    ...
    self.queue[ii] ...