Fixed Python2 vs Python3 division compatibility.

This commit is contained in:
Donne Martin
2015-07-06 06:58:42 -04:00
parent 40ef096ede
commit 53f7c0e4d8
3 changed files with 6 additions and 4 deletions

View File

@@ -36,7 +36,6 @@
"source": [
"## Constraints\n",
"\n",
"* Can I assume the string is ASCII?\n",
" * Yes\n",
" * Note: Unicode strings could require special handling depending on your language\n",
@@ -92,11 +91,14 @@
},
"outputs": [],
"source": [
"from __future__ import division\n",
"\n",
"\n",
"def list_of_chars(chars):\n",
" if chars is None:\n",
" return None\n",
" size = len(chars)\n",
" for i in range(size/2):\n",
" for i in range(size//2):\n",
" chars[i], chars[size-1-i] = \\\n",
" chars[size-1-i], chars[i]\n",
" return chars"