code bring out error | Sololearn: Learn to code for FREE!

0

code bring out error

class Queue: def __init__(self, contents): self._hiddenlist = list(contents) def push(self,value): self._hiddenlist.insert(0, value) def pop(self): return self._hiddenlist.pop(-1) def __repr__(self): return "Queue({ })".format(self.hiddenlist) queue = Queue([1, 2, 3,]) print(queue) queue.push(0) print(queue) queue.pop() print(queue) print(queue._hiddenlist)

3/24/2021 9:28:31 AM

Bien Ibiso Michael

2 Answers

New Answer

+3

you're missing an underscore in your attribute call inside the __repr__ overload. what are you trying to do with the __repr__ overload?

0

remove the space in {} and use format(self._hiddenlist)