Fix #13, PEP8-ify notebooks.

This commit is contained in:
Donne Martin
2015-07-11 15:34:14 -04:00
parent 27c4a4f97c
commit 374d67ff30
18 changed files with 117 additions and 80 deletions

View File

@@ -34,7 +34,6 @@
"source": [
"## Constraints\n",
"\n",
"* Can you assume the string is ASCII?\n",
" * Yes\n",
" * Note: Unicode strings could require special handling depending on your language\n",
@@ -85,6 +84,7 @@
" # TODO: Implement me\n",
" pass\n",
"\n",
"\n",
"def is_rotation(s1, s2):\n",
" # TODO: Implement me\n",
" # Call is_substring only once\n",
@@ -120,7 +120,7 @@
"\n",
"\n",
"class TestRotation(object):\n",
" \n",
"\n",
" def test_rotation(self):\n",
" assert_equal(is_rotation('o', 'oo'), False)\n",
" assert_equal(is_rotation(None, 'foo'), False)\n",
@@ -129,10 +129,12 @@
" assert_equal(is_rotation('foobarbaz', 'barbazfoo'), True)\n",
" print('Success: test_rotation')\n",
"\n",
"\n",
"def main():\n",
" test = TestRotation()\n",
" test.test_rotation()\n",
"\n",
"\n",
"if __name__ == '__main__':\n",
" main()"
]

View File

@@ -34,7 +34,6 @@
"source": [
"## Constraints\n",
"\n",
"* Can you assume the string is ASCII?\n",
" * Yes\n",
" * Note: Unicode strings could require special handling depending on your language\n",
@@ -91,9 +90,10 @@
},
"outputs": [],
"source": [
"def is_substring(s1, s2): \n",
"def is_substring(s1, s2):\n",
" return s1 in s2\n",
"\n",
"\n",
"def is_rotation(s1, s2):\n",
" if s1 is None or s2 is None:\n",
" return False\n",
@@ -131,7 +131,7 @@
"\n",
"\n",
"class TestRotation(object):\n",
" \n",
"\n",
" def test_rotation(self):\n",
" assert_equal(is_rotation('o', 'oo'), False)\n",
" assert_equal(is_rotation(None, 'foo'), False)\n",
@@ -140,10 +140,12 @@
" assert_equal(is_rotation('foobarbaz', 'barbazfoo'), True)\n",
" print('Success: test_rotation')\n",
"\n",
"\n",
"def main():\n",
" test = TestRotation()\n",
" test.test_rotation()\n",
"\n",
"\n",
"if __name__ == '__main__':\n",
" main()"
]

View File

@@ -2,7 +2,7 @@ from nose.tools import assert_equal
class TestRotation(object):
def test_rotation(self):
assert_equal(is_rotation('o', 'oo'), False)
assert_equal(is_rotation(None, 'foo'), False)
@@ -11,9 +11,11 @@ class TestRotation(object):
assert_equal(is_rotation('foobarbaz', 'barbazfoo'), True)
print('Success: test_rotation')
def main():
test = TestRotation()
test.test_rotation()
if __name__ == '__main__':
main()