Python Linked List: Delete the first item from a singly linked list
6. Delete First Item in Singly Linked List
Write a Python program to delete the first item from a singly linked list.
Sample Solution:
Python Code:
Sample Output:
Original list: PHP Python C# C++ Java After removing the first item from the list: Python C# C++ Java
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to delete the first node of a singly linked list and then iterate over the modified list to print the remaining values.
- Write a Python script to remove the head node from a singly linked list and return the new head, ensuring proper pointer updates.
- Write a Python program to implement deletion of the first element and verify that the list becomes empty if it contained only one node.
- Write a Python function to delete the first node in a singly linked list and update a size counter accordingly.
Go to:
Previous: Write a Python program to set a new value of an item in a singly linked list using index value.
Next: Write a Python program to delete the last item from a singly linked list.
Python Code Editor:
Contribute your code and comments through Disqus.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.