mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-08 18:38:03 +00:00
Fix #13, PEP8-ify notebooks.
This commit is contained in:
@@ -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()"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user