mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-09 02:48:02 +00:00
Fix #13, PEP8-ify notebooks.
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
class Node(object):
|
||||
|
||||
|
||||
def __init__(self, data, next_node=None):
|
||||
self.next = next_node
|
||||
self.data = data
|
||||
|
||||
|
||||
def __str__(self):
|
||||
return self.data
|
||||
|
||||
|
||||
class LinkedList(object):
|
||||
|
||||
|
||||
def __init__(self, head=None):
|
||||
self.head = head
|
||||
|
||||
@@ -19,7 +20,7 @@ class LinkedList(object):
|
||||
counter += 1
|
||||
curr = curr.next
|
||||
return counter
|
||||
|
||||
|
||||
def insert_to_front(self, data):
|
||||
if data is None:
|
||||
return
|
||||
@@ -30,7 +31,7 @@ class LinkedList(object):
|
||||
node.next = self.head
|
||||
self.head = node
|
||||
return node
|
||||
|
||||
|
||||
def append(self, data, next_node=None):
|
||||
if data is None:
|
||||
return
|
||||
@@ -43,7 +44,7 @@ class LinkedList(object):
|
||||
curr_node = curr_node.next
|
||||
curr_node.next = node
|
||||
return node
|
||||
|
||||
|
||||
def find(self, data):
|
||||
if data is None:
|
||||
return
|
||||
@@ -56,7 +57,7 @@ class LinkedList(object):
|
||||
else:
|
||||
curr_node = curr_node.next
|
||||
return
|
||||
|
||||
|
||||
def delete(self, data):
|
||||
if data is None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user