From 58a2cf58a4601d57c8c0944d492383e364a279b4 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Mon, 18 May 2020 23:20:32 +0200 Subject: [PATCH 1/3] singly_linked_list.py: psf/black --- data_structures/linked_list/singly_linked_list.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_structures/linked_list/singly_linked_list.py b/data_structures/linked_list/singly_linked_list.py index 516facc613eb..4377fc28022a 100644 --- a/data_structures/linked_list/singly_linked_list.py +++ b/data_structures/linked_list/singly_linked_list.py @@ -106,7 +106,7 @@ def __setitem__(self, index, data): raise IndexError("Index out of range.") current = current.next current.data = data - + def __len__(self): """ Return length of linked list i.e. number of nodes From 34c23b14fec4dc25d693dfcaa9d7c4510db271a2 Mon Sep 17 00:00:00 2001 From: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Date: Mon, 18 May 2020 21:20:57 +0000 Subject: [PATCH 2/3] updating DIRECTORY.md --- DIRECTORY.md | 1 + 1 file changed, 1 insertion(+) diff --git a/DIRECTORY.md b/DIRECTORY.md index bef7bca86cc3..aea74f9255f9 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -295,6 +295,7 @@ * [Add](https://github.com/TheAlgorithms/Python/blob/master/maths/add.py) * [Aliquot Sum](https://github.com/TheAlgorithms/Python/blob/master/maths/aliquot_sum.py) * [Allocation Number](https://github.com/TheAlgorithms/Python/blob/master/maths/allocation_number.py) + * [Area](https://github.com/TheAlgorithms/Python/blob/master/maths/area.py) * [Area Under Curve](https://github.com/TheAlgorithms/Python/blob/master/maths/area_under_curve.py) * [Armstrong Numbers](https://github.com/TheAlgorithms/Python/blob/master/maths/armstrong_numbers.py) * [Average Mean](https://github.com/TheAlgorithms/Python/blob/master/maths/average_mean.py) From 3a5a44e1cc0e98bbbae857887e53f56a4769be10 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Tue, 19 May 2020 13:15:23 +0200 Subject: [PATCH 3/3] Update singly_linked_list.py --- data_structures/linked_list/singly_linked_list.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data_structures/linked_list/singly_linked_list.py b/data_structures/linked_list/singly_linked_list.py index 4377fc28022a..1f3e03a31b7e 100644 --- a/data_structures/linked_list/singly_linked_list.py +++ b/data_structures/linked_list/singly_linked_list.py @@ -1,9 +1,9 @@ -class Node: # create a Node +class Node: def __init__(self, data): - self.data = data # given data - self.next = None # given next to None + self.data = data + self.next = None - def __repr__(self): # string representation of a Node + def __repr__(self): return f"Node({self.data})"