13th February Q's...dsa

class Stack:
def init(self):
self.stack = []
def push(self, item):
self.stack.append(item)
def pop(self):
if len(self.stack) == 0:
return None
else:
return self.stack.pop()
def peek(self):
if len(self.stack) == 0:
return None
else:
return self.stack[-1]
def is_empty(self):
return len(self.stack) == 0

1 Like

Good going @sayanalu9091
keep practicing

Correct, keep it up.
Practice more.

1 Like