Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lists topic python
#1
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.)

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)
Reply


Messages In This Thread
Lists topic python - by Tjay - Oct-14-2019, 07:13 PM
RE: Lists topic python - by jefsummers - Oct-14-2019, 07:20 PM
RE: Lists topic python - by Larz60+ - Oct-14-2019, 07:21 PM
RE: Lists topic python - by Tjay - Oct-14-2019, 07:31 PM
RE: Lists topic python - by Larz60+ - Oct-14-2019, 08:06 PM
RE: Lists topic python - by Tjay - Oct-14-2019, 08:17 PM
RE: Lists topic python - by jefsummers - Oct-15-2019, 01:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python Program "Topic" 150 lines of code. sean1 3 2,489 Dec-25-2021, 05:49 AM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020