Python Forum
Deleting the first item in linked list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting the first item in linked list
#2
Using list as a variable name is a bad idea. list is a built-in, and by using it as a variable name, you block the use of the built-in, which could cause errors in other code.

Let's say your linked list is called llist. llist is actually the first item in you list, and it links to the next item in the list. The second item in the list is llist.next. Can you see then how to make the first item in your list be the second item in your list, thus deleting the previous first item?
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Deleting the first item in linked list - by dan789 - Mar-05-2019, 03:12 PM
RE: Deleting the first item in linked list - by ichabod801 - Mar-05-2019, 03:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Finding string in list item jesse68 8 1,929 Jun-30-2022, 08:27 AM
Last Post: Gribouillis
  how to easily create a list of already existing item CompleteNewb 15 3,654 Jan-06-2022, 12:48 AM
Last Post: CompleteNewb
  Remove an item from a list contained in another item in python CompleteNewb 19 5,864 Nov-11-2021, 06:43 AM
Last Post: Gribouillis
  About linked lists ManoEl 2 1,633 Oct-17-2021, 03:21 PM
Last Post: ManoEl
  deleting select items from a list Skaperen 13 4,651 Oct-11-2021, 01:02 AM
Last Post: Skaperen
  count item in list korenron 8 3,536 Aug-18-2021, 06:40 AM
Last Post: naughtyCat
  Time.sleep: stop appending item to the list if time is early quest 0 1,894 Apr-13-2021, 11:44 AM
Last Post: quest
  How to run a pytest test for each item in a list arielma 0 2,386 Jan-06-2021, 10:40 PM
Last Post: arielma
  Deleting employee from list SephMon 3 3,311 Jan-05-2021, 04:15 AM
Last Post: deanhystad
  How to create a linked list and call it? loves 12 4,639 Nov-22-2020, 03:50 PM
Last Post: loves

Forum Jump:

User Panel Messages

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