Python Linked List: Find the size of a singly linked list
2. Singly Linked List Size
Write a Python program to find the size of a singly linked list.
Sample Solution:
Python Code:
Sample Output:
Original list: PHP Python C# C++ Java Size of the list: 5
Flowchart:

For more Practice: Solve these Related Problems:
- Write a Python program to compute the size of a singly linked list by iterating through its nodes.
- Write a Python script to count the nodes of a singly linked list using a recursive function.
- Write a Python program to create a singly linked list and update a counter during each append, then verify the total size by iteration.
- Write a Python program to measure the time taken to compute the size of a large singly linked list and print the result.
Go to:
Previous: Write a Python program to create a singly linked list, append some items and iterate through the list.
Next: Write a Python program to search a specific item in a singly linked list and return true if the item is found otherwise return false.
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.