mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-07 01:48:02 +00:00
Changed xrange to range to be compatible with Python 3.
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user