Skip to content

added __len__ function#1812

Merged
cclauss merged 3 commits intomasterfrom
unknown repository
May 18, 2020
Merged

added __len__ function#1812
cclauss merged 3 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Mar 25, 2020

Added a function to count number of nodes in linked list

Added a function to count number of nodes in linked list

def __len__(self):
"""Return length of linked list i.e. number of nodes """
curNode = self.head
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python naming uses snake_case so cur_node

@stale
Copy link
Copy Markdown

stale bot commented May 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Used to mark an issue or pull request stale. label May 2, 2020
used snake_case instead of camel case
@stale stale bot removed the stale Used to mark an issue or pull request stale. label May 2, 2020
@cclauss cclauss merged commit f9e0dd9 into TheAlgorithms:master May 18, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* added __len__ function

Added a function to count number of nodes in linked list

* Updated __len__ method

used snake_case instead of camel case

* Add tests to __len__()

Co-authored-by: Christian Clauss <cclauss@me.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant