code bring out error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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)

24th Mar 2021, 9:28 AM
Bien Ibiso Michael
Bien Ibiso Michael - avatar
2 Answers
+ 3
you're missing an underscore in your attribute call inside the __repr__ overload. what are you trying to do with the __repr__ overload?
24th Mar 2021, 9:37 AM
Slick
Slick - avatar
0
remove the space in {} and use format(self._hiddenlist)
24th Mar 2021, 12:31 PM
Vitaly Sokol
Vitaly Sokol - avatar