""" A skeleton of Stack using singly linked list. Students need to complete the implementation. CSCI 204, Spring 2020 Xiannong Meng """ class Node: ''' A simple Node class ''' def __init__(self, data = None, next = None): self.data = data self.next = next class Stack: ''' A class of linked lists based stack Data attributes - self.top = a reference to the first Node in the list ''' def __init__(self): ''' Set the stack top to be None ''' pass def __str__(self): ''' Create and return a string representation for the stack ''' s = "[" curr_node = self.top while curr_node: s += str(curr_node.data) curr_node = curr_node.next if curr_node != None: s += " -> " s += "]" return s # ----------- BASIC STACK OPERATIONS --------------# def push(self, data): """ Push an item to the top of the stack """ # need to create a node with data, then add the node to the stack pass def pop(self): """ Pop the top item from the stack """ pass def is_empty(self): """ Return True if stack is empty, False otherwise""" pass def peek(self): """ Return the data at the top of the stack""" pass