Move string permutation to a class

This commit is contained in:
Donne Martin
2016-08-13 06:39:19 -04:00
parent aa887db2e0
commit 22e3549d7d
3 changed files with 39 additions and 26 deletions

View File

@@ -84,9 +84,11 @@
},
"outputs": [],
"source": [
"def permutations(str1, str2):\n",
" # TODO: Implement me\n",
" pass"
"class Permutations(object):\n",
"\n",
" def is_permutation(self, str1, str2):\n",
" # TODO: Implement me\n",
" pass"
]
},
{
@@ -130,9 +132,11 @@
"\n",
"def main():\n",
" test = TestPermutation()\n",
" test.test_permutation(permutations)\n",
" permutations = Permutations()\n",
" test.test_permutation(permutations.is_permutation)\n",
" try:\n",
" test.test_permutation(permutations_alt)\n",
" permutations_alt = PermutationsAlt()\n",
" test.test_permutation(permutations_alt.is_permutation)\n",
" except NameError:\n",
" # Alternate solutions are only defined\n",
" # in the solutions file\n",