mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-03 16:08:02 +00:00
@@ -73,9 +73,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def change_ways(n, coins):\n",
|
||||
@@ -97,21 +95,19 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# %load test_coin_change_ways.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class Challenge(object):\n",
|
||||
"class Challenge(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_coin_change_ways(self,solution):\n",
|
||||
" assert_equal(solution(0, [1, 2]), 0)\n",
|
||||
" assert_equal(solution(100, [1, 2, 3]), 884)\n",
|
||||
" assert_equal(solution(1000, range(1, 101)), \n",
|
||||
" self.assertEqual(solution(0, [1, 2]), 0)\n",
|
||||
" self.assertEqual(solution(100, [1, 2, 3]), 884)\n",
|
||||
" self.assertEqual(solution(1000, range(1, 101)), \n",
|
||||
" 15658181104580771094597751280645)\n",
|
||||
" print('Success: test_coin_change_ways')\n",
|
||||
"\n",
|
||||
@@ -151,9 +147,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
@@ -68,9 +68,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def change_ways(n, coins):\n",
|
||||
@@ -92,9 +90,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -106,15 +102,15 @@
|
||||
],
|
||||
"source": [
|
||||
"%%writefile test_coin_change_ways.py\n",
|
||||
"from nose.tools import assert_equal\n",
|
||||
"import unittest\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"class Challenge(object):\n",
|
||||
"class Challenge(unittest.TestCase):\n",
|
||||
"\n",
|
||||
" def test_coin_change_ways(self,solution):\n",
|
||||
" assert_equal(solution(0, [1, 2]), 0)\n",
|
||||
" assert_equal(solution(100, [1, 2, 3]), 884)\n",
|
||||
" assert_equal(solution(1000, range(1, 101)), \n",
|
||||
" self.assertEqual(solution(0, [1, 2]), 0)\n",
|
||||
" self.assertEqual(solution(100, [1, 2, 3]), 884)\n",
|
||||
" self.assertEqual(solution(1000, range(1, 101)), \n",
|
||||
" 15658181104580771094597751280645)\n",
|
||||
" print('Success: test_coin_change_ways')\n",
|
||||
"\n",
|
||||
@@ -131,9 +127,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
},
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -164,9 +158,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.7.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 0
|
||||
"nbformat_minor": 1
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
from nose.tools import assert_equal
|
||||
import unittest
|
||||
|
||||
|
||||
class Challenge(object):
|
||||
class Challenge(unittest.TestCase):
|
||||
|
||||
def test_coin_change_ways(self,solution):
|
||||
assert_equal(solution(0, [1, 2]), 0)
|
||||
assert_equal(solution(100, [1, 2, 3]), 884)
|
||||
assert_equal(solution(1000, range(1, 101)), 15658181104580771094597751280645)
|
||||
self.assertEqual(solution(0, [1, 2]), 0)
|
||||
self.assertEqual(solution(100, [1, 2, 3]), 884)
|
||||
self.assertEqual(solution(1000, range(1, 101)),
|
||||
15658181104580771094597751280645)
|
||||
print('Success: test_coin_change_ways')
|
||||
|
||||
|
||||
@@ -16,4 +17,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user