I am trying to implement a simple stack with Python using arrays. I was wondering if someone could let me know what\'s wrong with my code.
class myStack:
Below is my implementation
class Stack:
def __init__(self):
self.items = list()
def is_empty(self):
return self.items == []
def peek(self):
if self.is_empty():
print('Cannot peek empty stack')
return
else:
return self.items[-1]
def pop(self):
if self.is_empty():
print('Cannot pop an empty stack')
return
else:
return self.items.pop()
def size(self):
return len(self.items)
def push(self,data):
self.items.append(data)