From a88ad60365f73c45eada1f9534f3a04aa6d3f491 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sun, 21 Jan 2018 08:59:55 +0100 Subject: [PATCH] Update singly_LinkedList.py --- data_structures/LinkedList/singly_LinkedList.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data_structures/LinkedList/singly_LinkedList.py b/data_structures/LinkedList/singly_LinkedList.py index b2e65870c..7285e3762 100644 --- a/data_structures/LinkedList/singly_LinkedList.py +++ b/data_structures/LinkedList/singly_LinkedList.py @@ -9,7 +9,7 @@ class Node: # create a Node class Linked_List: def insert_tail(Head, data): - if(Head.next is None): + if Head.next is None: Head.next = Node(data) else: Head.next.insert_tail(data) @@ -43,7 +43,7 @@ class Linked_List: if Head is not None: tamp = Node() tamp = Head - while (tamp.next).next is not None: # find the 2nd last element + while tamp.next.next is not None: # find the 2nd last element tamp = tamp.next # delete the last element by give next None to 2nd last Element tamp.next = None @@ -56,7 +56,7 @@ class Linked_List: prev = None current = Head - while(current): + while current: # Store the current node's next node. next_node = current.next # Make the current node's next point backwards