Cleaned up cell execution numbers, minor PEP8 line break tweak.

This commit is contained in:
Donne Martin 2015-08-09 07:30:37 -04:00
parent 039baaa116
commit c1e759f3da
3 changed files with 16 additions and 29 deletions

View File

@ -100,13 +100,7 @@
"metadata": {
"collapsed": false
},
"outputs": [
{
"name":"stdout",
"text":[],
"output_type": "stream"
}
],
"outputs": [],
"source": [
"# %load test_coin_change_ways.py\n",
"from nose.tools import assert_equal\n",
@ -117,7 +111,8 @@
" 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)), 15658181104580771094597751280645)\n",
" assert_equal(solution(1000, range(1, 101)), \n",
" 15658181104580771094597751280645)\n",
" print('Success: test_coin_change_ways')\n",
"\n",
"\n",
@ -156,7 +151,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"version": "2.7.10"
}
},
"nbformat": 4,

View File

@ -73,12 +73,12 @@
},
"outputs": [],
"source": [
"def change_ways(n, coins):\n",
" arr = [1] + [0] * n\n",
" for coin in coins:\n",
" for i in range(coin, n + 1):\n",
" arr[i] += arr[i - coin]\n",
" return 0 if n == 0 else arr[n]"
"def change_ways(n, coins):\n",
" arr = [1] + [0] * n\n",
" for coin in coins:\n",
" for i in range(coin, n + 1):\n",
" arr[i] += arr[i - coin]\n",
" return 0 if n == 0 else arr[n]"
]
},
{
@ -91,7 +91,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 2,
"metadata": {
"collapsed": false
},
@ -114,7 +114,8 @@
" 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)), 15658181104580771094597751280645)\n",
" assert_equal(solution(1000, range(1, 101)), \n",
" 15658181104580771094597751280645)\n",
" print('Success: test_coin_change_ways')\n",
"\n",
"\n",
@ -129,7 +130,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {
"collapsed": false
},
@ -145,15 +146,6 @@
"source": [
"%run -i test_coin_change_ways.py"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
@ -172,7 +164,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"version": "2.7.10"
}
},
"nbformat": 4,

View File

@ -16,4 +16,4 @@ def main():
if __name__ == '__main__':
main()
main()