class Node:
def __init__(self, datavalue=None):
self.datavalue = datavalue
self.nextvalue = None
class LinkedList:
def __init__(self):
self.headvalue = None
def listprint(self):
printvalue = self.headvalue
while printvalue is not None:
print (printvalue.datavalue)
printvalue = printvalue.nextvalue
list = LinkedList()
list.headvalue = Node("Howdi y'all.")
l2 = Node("Welcome to HOOAI!")
l3 = Node("미국남부형 likes an iced americano.")
l4 = Node("Thank you.")
list.headvalue.nextvalue = l2
l2.nextvalue = l3
l3.nextvalue = l4
list.listprint()
728x90
'Programming Languages > Python' 카테고리의 다른 글
[파이썬 질문] 파이참에서 %matplotlib inline 안될때 (0) | 2021.01.17 |
---|---|
[Python] open cv란? (0) | 2021.01.15 |
[Python] Linked List (0) | 2020.09.30 |
[Python 예제코드#1] Dictionary(딕셔너리) (0) | 2020.03.22 |
[Python examples#02] 간단한 입출력 예제코드 (0) | 2020.02.03 |
댓글