class Node:

def **init**(self, data):

self.data = data

self.next = None

class Stack:

def **init**(self):

self.head = None

```
def isempty(self):
if self.head == None:
return True
else:
return False
def push(self, data):
if self.head == None:
self.head = Node(data)
else:
newnode = Node(data)
newnode.next = self.head
self.head = newnode
def pop(self):
if self.isempty():
return None
def peek(self):
if self.isempty():
return None
else:
return self.head.data
```

M_Stack = Stack()

M_Stack.push(11)

print("\nPushed element is “, M_Stack.peek())

M_Stack.pop()

print(”\nPopped element is “, M_Stack.peek())

M_Stack.push(22)

print(”\nPushed element is “, M_Stack.peek())

M_Stack.pop()

print(”\nPopped element is ", M_Stack.peek())