Skip to content

Commit 070feb3

Browse files
authored
Update linkedlist_nth_to_lastnode.py
find the nth element from last node of a given linked list. If nth value is greater than given linked list then through back LookupError.
1 parent 0dd7a1b commit 070feb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linkedlist_nth_to_lastnode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def nth_to_lastnode(n, head):
1010

1111
for i in range(n-1):
1212
if right_pointer.nextnode is None:
13-
raise LookupError("LookupError : n is greater than the linked list")
13+
raise LookupError("n is greater than the linked list")
1414
right_pointer = right_pointer.nextnode
1515

1616
while right_pointer.nextnode:

0 commit comments

Comments
 (0)