Stack via arrays (py)

Run Settings
LanguagePython
Language Version
Run Command
class Stack: def __init__(self, data=0): self.data = data def push(self,data): arr.append(data) def pop(self): arr.pop() def peek(self): print(arr[len(arr)-1]) if __name__ == '__main__': arr = [] stack = Stack() stack.push(5) stack.push(10) stack.push(15) stack.peek() stack.pop() stack.peek()
Editor Settings
Theme
Key bindings
Full width
Lines