Data Structure in Python3: Stack
luthfisauqi17
Posted on November 10, 2021
class Stack:
def __init__(self):
self.arr = []
def pop(self):
data = self.arr.pop()
return data
def push(self, data):
self.arr.append(data)
def peek(self):
return self.arr[len(self.arr)-1]
def isEmpty(self):
return len(self.arr) == 0
Sources and Images:
π πͺ π
π©
luthfisauqi17
Posted on November 10, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.