A student writes a small stack class. The program does not do what the student expects. class Stack: def __init__(self): self.data = [] def push(self, x): self.data.append(x) def size(): return len(self.data) s = Stack() s.push(4) print(s.size()) What happens when the program runs?
Log in to join the discussion.
Loading…