I am create a stack demo with some functionality:
( Method ) __init__(self, n) => How can I initial the fix n len of stack. ?
( Method ) IsEmpty => Done by using lists as stacks
( Method ) IsFull => Done by using lists as stacks
( Method ) Push => Done by using lists as stacks
( Method ) Pop => Done by using lists as stacks
The code i am doing
class Stack(object) :def __init__(self) :self.items = []def push(self, item) :self.items.append(item)def pop(self) :return self.items.pop()def isEmpty(self) :return (self.items == []) if __name__ == "__main__":demoStack = Stack()demoStack.push(1)print demoStack.items
Anyboday know to do this?
thanks