Changed xrange to range to be compatible with Python 3.

This commit is contained in:
Donne Martin
2015-07-06 06:15:53 -04:00
parent fac7bbb1be
commit 45fa576bc2
21 changed files with 41 additions and 42 deletions

View File

@@ -125,7 +125,7 @@
" \n",
" def __init__(self, size):\n",
" self.size = size\n",
" self.table = [[] for _ in xrange(self.size)]\n",
" self.table = [[] for _ in range(self.size)]\n",
"\n",
" def hash_function(self, key):\n",
" return key % self.size\n",

View File

@@ -96,7 +96,7 @@
" if chars is None:\n",
" return None\n",
" size = len(chars)\n",
" for i in xrange(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"

View File

@@ -37,7 +37,6 @@
"source": [
"## Constraints\n",
"\n",
"* Can you assume the string is ASCII?\n",
" * Yes\n",
" * Note: Unicode strings could require special handling depending on your language\n",
@@ -259,21 +258,21 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.10"
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,