mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Standardize spacing code style (#150)
This commit is contained in:
parent
eba98452e3
commit
7884146d54
|
@ -100,9 +100,9 @@
|
|||
" if chars is None or not chars:\n",
|
||||
" return chars\n",
|
||||
" size = len(chars)\n",
|
||||
" for i in range(size//2):\n",
|
||||
" chars[i], chars[size-1-i] = \\\n",
|
||||
" chars[size-1-i], chars[i]\n",
|
||||
" for i in range(size // 2):\n",
|
||||
" chars[i], chars[size - 1 - i] = \\\n",
|
||||
" chars[size - 1 - i], chars[i]\n",
|
||||
" return chars"
|
||||
]
|
||||
},
|
||||
|
@ -307,7 +307,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
@ -107,9 +107,9 @@
|
|||
" def _move_disks(self, num_disks, src, dest, buff):\n",
|
||||
" if num_disks == 0:\n",
|
||||
" return\n",
|
||||
" self.move_disks(num_disks-1, src, buff, dest)\n",
|
||||
" self.move_disks(num_disks - 1, src, buff, dest)\n",
|
||||
" dest.push(src.pop())\n",
|
||||
" self.move_disks(num_disks-1, buff, dest, src)"
|
||||
" self.move_disks(num_disks - 1, buff, dest, src)"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -220,7 +220,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
|
@ -107,9 +107,9 @@
|
|||
" raise TypeError('data cannot be None')\n",
|
||||
" if len(data) < 2:\n",
|
||||
" return data\n",
|
||||
" for i in range(len(data)-1):\n",
|
||||
" for i in range(len(data) - 1):\n",
|
||||
" min_index = i\n",
|
||||
" for j in range(i+1, len(data)):\n",
|
||||
" for j in range(i + 1, len(data)):\n",
|
||||
" if data[j] < data[min_index]:\n",
|
||||
" min_index = j\n",
|
||||
" if data[min_index] < data[i]:\n",
|
||||
|
@ -121,7 +121,7 @@
|
|||
" raise TypeError('data cannot be None')\n",
|
||||
" if len(data) < 2:\n",
|
||||
" return data\n",
|
||||
" for i in range(len(data)-1):\n",
|
||||
" for i in range(len(data) - 1):\n",
|
||||
" self._swap(data, i, self._find_min_index(data, i))\n",
|
||||
" return data\n",
|
||||
"\n",
|
||||
|
@ -137,12 +137,12 @@
|
|||
" return\n",
|
||||
" if start < len(data) - 1:\n",
|
||||
" swap(data, start, self._find_min_index(data, start))\n",
|
||||
" self._sort_recursive(data, start+1)\n",
|
||||
" self._sort_recursive(data, start + 1)\n",
|
||||
" return data\n",
|
||||
"\n",
|
||||
" def _find_min_index(self, data, start):\n",
|
||||
" min_index = start\n",
|
||||
" for i in range(start+1, len(data)):\n",
|
||||
" for i in range(start + 1, len(data)):\n",
|
||||
" if data[i] < data[min_index]:\n",
|
||||
" min_index = i\n",
|
||||
" return min_index\n",
|
||||
|
@ -262,7 +262,7 @@
|
|||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.5.0"
|
||||
"version": "3.4.3"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
|
Loading…
Reference in New Issue
Block a user