mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Tweaked reverse challenge code solution.
This commit is contained in:
parent
11bd2e9768
commit
a1990f2298
|
@ -93,14 +93,14 @@
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"def list_of_chars(list_chars):\n",
|
"def list_of_chars(chars):\n",
|
||||||
" if list_chars is None:\n",
|
" if chars is None:\n",
|
||||||
" return None\n",
|
" return None\n",
|
||||||
" string_length = len(list_chars)\n",
|
" size = len(chars)\n",
|
||||||
" for i in xrange(string_length/2):\n",
|
" for i in xrange(size/2):\n",
|
||||||
" list_chars[i], list_chars[string_length-1-i] = \\\n",
|
" chars[i], chars[size-1-i] = \\\n",
|
||||||
" list_chars[string_length-1-i], list_chars[i]\n",
|
" chars[size-1-i], chars[i]\n",
|
||||||
" return list_chars"
|
" return chars"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user