mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 09:58:03 +00:00
Move string permutation to a class
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user