Oct-14-2019, 07:13 PM
i been told to post it as new question in here. I am beginner on python and wanted some help to see if i am doing the right thing below and the next step to take with this thanks.
This is the question:
Create a simple list to hold the items 1,2,3,4, creating the list “from the front” as in Slide 48.[Notice how the list is only complete when you have finished.]Use the code from Slide 50 to print out your list. (You may want to write this as a function.)
This is the question:
Create a simple list to hold the items 1,2,3,4, creating the list “from the front” as in Slide 48.[Notice how the list is only complete when you have finished.]Use the code from Slide 50 to print out your list. (You may want to write this as a function.)
class Node: pass start = Node() point = start point.data = 1 point.next = Node() point = point.next point.data = 2 point.next = Node() point = point.next point.data = 3 point.next = Node() point = point.next point.data = 4 point.next = None def func1(): point = start print(point.data) point = point.next print(point.data) point = point.next print(point.data) point = point.next print(point.data) point = point.next print("point:", point) func1()Also, did i assemble the code properly that i got from the slide 48 and 50(read question)