Fix #13, PEP8-ify notebooks.

This commit is contained in:
Donne Martin
2015-07-11 15:39:59 -04:00
parent 4566d1a803
commit 3712839cc9
26 changed files with 139 additions and 92 deletions

View File

@@ -34,7 +34,6 @@
"source": [
"## Constraints\n",
"\n",
"* When sorted, should the largest element be at the top or bottom?\n",
" * Top\n",
"* Can you have duplicate values like 5, 5?\n",
@@ -92,7 +91,7 @@
"outputs": [],
"source": [
"class MyStack(Stack):\n",
" \n",
"\n",
" def sort(self):\n",
" # TODO: Implement me\n",
" pass"
@@ -123,7 +122,7 @@
"\n",
"\n",
"class TestSortStack(object):\n",
" \n",
"\n",
" def get_sorted_stack(self, numbers):\n",
" stack = MyStack()\n",
" for x in numbers:\n",
@@ -148,13 +147,15 @@
" for _ in range(num_items):\n",
" sorted_numbers.append(sorted_stack.pop())\n",
" assert_equal(sorted_numbers, sorted(numbers, reverse=True))\n",
" \n",
"\n",
" print('Success: test_sort_stack')\n",
"\n",
"\n",
"def main():\n",
" test = TestSortStack()\n",
" test.test_sort_stack()\n",
"\n",
"\n",
"if __name__ == '__main__':\n",
" main()"
]

View File

@@ -33,7 +33,6 @@
"source": [
"## Constraints\n",
"\n",
"* When sorted, should the largest element be at the top or bottom?\n",
" * Top\n",
"* Can you have duplicate values like 5, 5?\n",
@@ -101,7 +100,7 @@
"outputs": [],
"source": [
"class MyStack(Stack):\n",
" \n",
"\n",
" def sort(self):\n",
" buff = MyStack()\n",
" while not self.is_empty():\n",
@@ -142,7 +141,7 @@
"\n",
"\n",
"class TestSortStack(object):\n",
" \n",
"\n",
" def get_sorted_stack(self, numbers):\n",
" stack = MyStack()\n",
" for x in numbers:\n",
@@ -167,13 +166,15 @@
" for _ in range(num_items):\n",
" sorted_numbers.append(sorted_stack.pop())\n",
" assert_equal(sorted_numbers, sorted(numbers, reverse=True))\n",
" \n",
"\n",
" print('Success: test_sort_stack')\n",
"\n",
"\n",
"def main():\n",
" test = TestSortStack()\n",
" test.test_sort_stack()\n",
"\n",
"\n",
"if __name__ == '__main__':\n",
" main()"
]

View File

@@ -31,9 +31,11 @@ class TestSortStack(object):
print('Success: test_sort_stack')
def main():
test = TestSortStack()
test.test_sort_stack()
if __name__ == '__main__':
main()