I'm a beginner in python and I'm having a problem in this program:
Here's the NodeList first:
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
My problem is in this program: (The print)
from NodeList import Node
class StackLL:
def __init__(self):
self.head = None
def pushSLL(self,item):
temp = Node(str(item))
temp.setNext(self.head)
self.head = temp
node = self.head
print(chr(0x2510)+(chr(0x0000)*(len(item)))+chr(0x250c))
while node!=None:
stackeditem = chr(0x2502)+node.data+chr(0x2502)
print(stackeditem)
node = node.next
print(chr(0x2514)+(chr(0x2500)*(len(item)-1))+chr(0x2518))

Everytime I print, the lines just seems off. I tried to experiment using len() just to make it accurate, but everytime the item adds more characters it gets off again. Any help would be greatly appreciated. Thank you.
