728x90
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
'Python > Python Examples' 카테고리의 다른 글
[Python Example Codes] Matplotlib Scatter #01 (0) | 2021.12.07 |
---|---|
[Python Examples] While Loops(While문) - #01 (0) | 2021.05.31 |
[Python Examples] Random 함수로 실수 구하기: #random.random(), #random.uniform() (0) | 2021.02.02 |
[파이썬 예제코드] tkinter를 활용한 폴더 선택하기 (0) | 2021.01.20 |
[Python 예제코드#1] Dictionary(딕셔너리) (0) | 2020.03.22 |
댓글