Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Commit

Permalink
better solution using pop by Matt
Browse files Browse the repository at this point in the history
  • Loading branch information
fbkarsdorp committed Jul 26, 2014
1 parent 8c95cbd commit 7981b50
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions answerbook/Chapter 10 - Learning without Supervision.ipynb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:4a735510c93747b11ebb86855c4f985cce0023c63086b07a69dc1e0d784b3667"
"signature": "sha256:caf39a94b435791ab9dd1d40c5df8860ec234626e7807676f49efbe17774d245"
},
"nbformat": 3,
"nbformat_minor": 0,
Expand Down Expand Up @@ -540,9 +540,8 @@
" \n",
" def merge(self, i, j):\n",
" # insert your code here\n",
" self._clusters[i] = Cluster(self._n, self._clusters[i], self._clusters[j])\n",
" self._clusters[i] = Cluster(self._n, self._clusters[i], self._clusters.pop(j))\n",
" self._n += 1\n",
" del self._clusters[j]\n",
" \n",
" def __str__(self):\n",
" return '%s' % self._clusters[0]\n",
Expand Down

0 comments on commit 7981b50

Please sign in to comment.