class Node():
def __init__(self,data):
self.prev = None
self.next = None
self.data = data
class DLL():
def __init__(self):
self.head =None
self.size = 0
def __str__(self):
text = ''
temp = self. head
while temp:
text += str(temp.data) + ' '
temp = temp.next
return text
def append(self,data):
if self.head == None:
self.head = Node(data)
else:
temp = self.head
while True:
if temp.next == None:
break
temp = temp.next
temp.next = Node(data)
temp.next.prev = temp
def insert(self):
pass
def remobe(self):
pass
def pop(self):
pass
a = DLL()
a.append(10)
print(a)
a.append(20)
print(a)
댓글
0개댓글 쓰기
댓글을 작성하려면 로그인하세요.