can-you-do-my-assignment-with-extra-credit-for-python-

can-you-do-my-assignment-with-extra-credit-for-python-

node.py:

class Node:

def __init__(self, initdata):

self.data = initdata

self.next = None

def getData(self):

return self.data

def getNext(self):

return self.next

def setData(self, newData):

self.data = newData

def setNext(self, newnext):

self.next = newnext

————————————————————————————————–

llstack.py:

from node import Node

class LLStack:

def __init__(self):

self.head = None

def isEmpty(self):

return self.head == None

def push(self, item):

temp = Node(item)

temp.setNext(self.head)

self.head = temp

def pop(self):

item = self.head.getData()

self.head = self.head.getNext()

return item

def length(self):

current = self.head

count = 0

while current != None:

count += 1

current = current.getNext()

return count

def printList(self):

current = self.head

while current != None:

print(current.getData(), end = ” “)

current = current.getNext()

print()