mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-10 19:38:02 +00:00
Fix #13, PEP8-ify notebooks.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
class Node(object):
|
||||
|
||||
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
self.next = None
|
||||
|
||||
|
||||
class Stack(object):
|
||||
|
||||
|
||||
def __init__(self, top=None):
|
||||
self.top = top
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"* None"
|
||||
]
|
||||
},
|
||||
@@ -92,13 +91,14 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Node(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" def __init__(self, data):\n",
|
||||
" # TODO: Implement me\n",
|
||||
" pass\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class Stack(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" def __init__(self, top=None):\n",
|
||||
" # TODO: Implement me\n",
|
||||
" pass\n",
|
||||
@@ -144,7 +144,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestStack(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" # TODO: It would be better if we had unit tests for each\n",
|
||||
" # method in addition to the following end-to-end test\n",
|
||||
" def test_end_to_end(self):\n",
|
||||
@@ -172,13 +172,15 @@
|
||||
" assert_equal(stack.pop(), 1)\n",
|
||||
" assert_equal(stack.peek(), None)\n",
|
||||
" assert_equal(stack.is_empty(), True)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" print('Success: test_end_to_end')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestStack()\n",
|
||||
" test.test_end_to_end()\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"* None"
|
||||
]
|
||||
},
|
||||
@@ -137,13 +136,14 @@
|
||||
"source": [
|
||||
"%%writefile stack.py\n",
|
||||
"class Node(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" def __init__(self, data):\n",
|
||||
" self.data = data\n",
|
||||
" self.next = None\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class Stack(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" def __init__(self, top=None):\n",
|
||||
" self.top = top\n",
|
||||
"\n",
|
||||
@@ -208,7 +208,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestStack(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" # TODO: It would be better if we had unit tests for each\n",
|
||||
" # method in addition to the following end-to-end test\n",
|
||||
" def test_end_to_end(self):\n",
|
||||
@@ -236,13 +236,15 @@
|
||||
" assert_equal(stack.pop(), 1)\n",
|
||||
" assert_equal(stack.peek(), None)\n",
|
||||
" assert_equal(stack.is_empty(), True)\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" print('Success: test_end_to_end')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestStack()\n",
|
||||
" test.test_end_to_end()\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
||||
@@ -2,7 +2,7 @@ from nose.tools import assert_equal
|
||||
|
||||
|
||||
class TestStack(object):
|
||||
|
||||
|
||||
# TODO: It would be better if we had unit tests for each
|
||||
# method in addition to the following end-to-end test
|
||||
def test_end_to_end(self):
|
||||
@@ -30,12 +30,14 @@ class TestStack(object):
|
||||
assert_equal(stack.pop(), 1)
|
||||
assert_equal(stack.peek(), None)
|
||||
assert_equal(stack.is_empty(), True)
|
||||
|
||||
|
||||
print('Success: test_end_to_end')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestStack()
|
||||
test.test_end_to_end()
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user