Fix #13, PEP8-ify notebooks.

This commit is contained in:
Donne Martin
2015-07-11 15:34:52 -04:00
parent 374d67ff30
commit 04083b2011
25 changed files with 210 additions and 173 deletions

View File

@@ -34,7 +34,6 @@
"source": [
"## Constraints\n",
"\n",
"* Is this a singly or doubly linked list?\n",
" * Singly\n",
"* Can you insert None values in the list?\n",
@@ -94,7 +93,7 @@
"outputs": [],
"source": [
"class MyLinkedList(LinkedList):\n",
" \n",
"\n",
" def remove_dupes(self):\n",
" # TODO: Implement me\n",
" pass"
@@ -129,7 +128,7 @@
"\n",
"\n",
"class TestRemoveDupes(object):\n",
" \n",
"\n",
" def test_remove_dupes(self, linked_list):\n",
" print('Test: Empty list')\n",
" linked_list.remove_dupes()\n",
@@ -151,14 +150,16 @@
" print('Test: General case, no duplicates')\n",
" linked_list.remove_dupes()\n",
" assert_equal(linked_list.get_all_data(), [1, 3, 2])\n",
" \n",
"\n",
" print('Success: test_remove_dupes\\n')\n",
"\n",
"\n",
"def main():\n",
" test = TestRemoveDupes()\n",
" linked_list = MyLinkedList(None)\n",
" test.test_remove_dupes(linked_list)\n",
" \n",
"\n",
"\n",
"if __name__ == '__main__':\n",
" main()"
]

View File

@@ -34,7 +34,6 @@
"source": [
"## Constraints\n",
"\n",
"* Is this a singly or doubly linked list?\n",
" * Singly\n",
"* Can you insert None values in the list?\n",
@@ -126,7 +125,7 @@
"outputs": [],
"source": [
"class MyLinkedList(LinkedList):\n",
" \n",
"\n",
" def remove_dupes(self):\n",
" seen_data = set()\n",
" curr = self.head\n",
@@ -138,7 +137,7 @@
" seen_data.add(curr.data)\n",
" prev = curr\n",
" curr = curr.next\n",
" \n",
"\n",
" def remove_dupes_in_place(self):\n",
" curr = self.head\n",
" while curr is not None:\n",
@@ -179,7 +178,7 @@
"\n",
"\n",
"class TestRemoveDupes(object):\n",
" \n",
"\n",
" def test_remove_dupes(self, linked_list):\n",
" print('Test: Empty list')\n",
" linked_list.remove_dupes()\n",
@@ -201,14 +200,16 @@
" print('Test: General case, no duplicates')\n",
" linked_list.remove_dupes()\n",
" assert_equal(linked_list.get_all_data(), [1, 3, 2])\n",
" \n",
"\n",
" print('Success: test_remove_dupes\\n')\n",
"\n",
"\n",
"def main():\n",
" test = TestRemoveDupes()\n",
" linked_list = MyLinkedList(None)\n",
" test.test_remove_dupes(linked_list)\n",
" \n",
"\n",
"\n",
"if __name__ == '__main__':\n",
" main()"
]

View File

@@ -2,7 +2,7 @@ from nose.tools import assert_equal
class TestRemoveDupes(object):
def test_remove_dupes(self, linked_list):
print('Test: Empty list')
linked_list.remove_dupes()
@@ -24,13 +24,15 @@ class TestRemoveDupes(object):
print('Test: General case, no duplicates')
linked_list.remove_dupes()
assert_equal(linked_list.get_all_data(), [1, 3, 2])
print('Success: test_remove_dupes\n')
def main():
test = TestRemoveDupes()
linked_list = MyLinkedList(None)
test.test_remove_dupes(linked_list)
if __name__ == '__main__':
main()