Stack data structure in python

No need to jump through these loops, See 5.1.1 Using Lists as Stacks

If you insist on having methods isEmpty() and push() you can do:

class stack(list):
    def push(self, item):
        self.append(item)
    def isEmpty(self):
        return not self

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)