{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "smart-plymouth",
   "metadata": {
    "nbgrader": {
     "grade": false,
     "grade_id": "cell-6aca377eade36d42",
     "locked": true,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "source": [
    "## Write a haiku below (1 point)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "handed-stopping",
   "metadata": {
    "nbgrader": {
     "grade": true,
     "grade_id": "haiku-answer",
     "locked": false,
     "points": 1,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "source": [
    "Haiku goes here"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "immediate-jumping",
   "metadata": {
    "nbgrader": {
     "grade": false,
     "grade_id": "cell-b98411dc1ebcd1a4",
     "locked": true,
     "points": 2,
     "schema_version": 3,
     "solution": false,
     "task": true
    }
   },
   "source": [
    "Another task.. worth two points, that is spread along multiple cells and manually graded."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "cooperative-healthcare",
   "metadata": {
    "nbgrader": {
     "grade": false,
     "grade_id": "cell-ff14169315ad87d3",
     "locked": false,
     "schema_version": 3,
     "solution": true,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "def squares(n):\n",
    "    \"\"\"Compute the squares of numbers from 1 to n\"\"\"\n",
    "    \n",
    "    ### BEGIN SOLUTION\n",
    "    if n < 1:\n",
    "        raise ValueError(\"n must be greater than or equal to 1\")\n",
    "    return [i**2 for i in range(1, n+1)]\n",
    "    ### END SOLUTION"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "processed-pepper",
   "metadata": {
    "nbgrader": {
     "grade": true,
     "grade_id": "cell-dee87c78c1785f81",
     "locked": true,
     "points": 3,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'nose'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-4-bd297c1c2cbf>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mnose\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtools\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0massert_equal\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      2\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0massert_equal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msquares\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      4\u001b[0m \u001b[0massert_equal\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msquares\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      5\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'nose'"
     ]
    }
   ],
   "source": [
    "from nose.tools import assert_equal\n",
    "\n",
    "assert_equal(squares(1), [1])\n",
    "assert_equal(squares(2), [1, 4])\n",
    "\n",
    "### BEGIN HIDDEN TESTS\n",
    "assert_equal(squares(3), [1, 4, 9])\n",
    "### END HIDDEN TESTS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "decent-diana",
   "metadata": {
    "nbgrader": {
     "grade": true,
     "grade_id": "cell-36cd318c1c136ece",
     "locked": true,
     "points": 4,
     "schema_version": 3,
     "solution": false,
     "task": false
    }
   },
   "outputs": [],
   "source": [
    "from nose.tools import assert_raises\n",
    "assert_raises(ValueError, squares, 0)\n",
    "assert_raises(ValueError, squares, -1)"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Create Assignment",
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
