mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-08 10:28:03 +00:00
Fix #13, PEP8-ify notebooks.
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"* Can we assume the string is ASCII?\n",
|
||||
" * Yes\n",
|
||||
" * Note: Unicode strings could require special handling depending on your language\n",
|
||||
@@ -114,7 +113,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestPermutation(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" def test_permutation(self, func):\n",
|
||||
" assert_equal(func('', 'foo'), False)\n",
|
||||
" assert_equal(func('Nib', 'bin'), False)\n",
|
||||
@@ -122,6 +121,7 @@
|
||||
" assert_equal(func('a ct', 'ca t'), True)\n",
|
||||
" print('Success: test_permutation')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestPermutation()\n",
|
||||
" test.test_permutation(permutations)\n",
|
||||
@@ -131,7 +131,8 @@
|
||||
" # Alternate solutions are only defined\n",
|
||||
" # in the solutions file\n",
|
||||
" pass\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
"source": [
|
||||
"## Constraints\n",
|
||||
"\n",
|
||||
|
||||
"* Can we assume the string is ASCII?\n",
|
||||
" * Yes\n",
|
||||
" * Note: Unicode strings could require special handling depending on your language\n",
|
||||
@@ -147,6 +146,7 @@
|
||||
" dict_chars[char] += 1\n",
|
||||
" return dict_chars\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def permutations_alt(str1, str2):\n",
|
||||
" if len(str1) != len(str2):\n",
|
||||
" return False\n",
|
||||
@@ -183,7 +183,7 @@
|
||||
"\n",
|
||||
"\n",
|
||||
"class TestPermutation(object):\n",
|
||||
" \n",
|
||||
"\n",
|
||||
" def test_permutation(self, func):\n",
|
||||
" assert_equal(func('', 'foo'), False)\n",
|
||||
" assert_equal(func('Nib', 'bin'), False)\n",
|
||||
@@ -191,6 +191,7 @@
|
||||
" assert_equal(func('a ct', 'ca t'), True)\n",
|
||||
" print('Success: test_permutation')\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def main():\n",
|
||||
" test = TestPermutation()\n",
|
||||
" test.test_permutation(permutations)\n",
|
||||
@@ -200,7 +201,8 @@
|
||||
" # Alternate solutions are only defined\n",
|
||||
" # in the solutions file\n",
|
||||
" pass\n",
|
||||
" \n",
|
||||
"\n",
|
||||
"\n",
|
||||
"if __name__ == '__main__':\n",
|
||||
" main()"
|
||||
]
|
||||
|
||||
@@ -2,7 +2,7 @@ from nose.tools import assert_equal
|
||||
|
||||
|
||||
class TestPermutation(object):
|
||||
|
||||
|
||||
def test_permutation(self, func):
|
||||
assert_equal(func('', 'foo'), False)
|
||||
assert_equal(func('Nib', 'bin'), False)
|
||||
@@ -10,6 +10,7 @@ class TestPermutation(object):
|
||||
assert_equal(func('a ct', 'ca t'), True)
|
||||
print('Success: test_permutation')
|
||||
|
||||
|
||||
def main():
|
||||
test = TestPermutation()
|
||||
test.test_permutation(permutations)
|
||||
@@ -19,6 +20,7 @@ def main():
|
||||
# Alternate solutions are only defined
|
||||
# in the solutions file
|
||||
pass
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user