diff --git a/p1/p1.ipynb b/p1/p1.ipynb index 5fb9e1aff2f0693bc9e61dbc79d381b1a39c9d3e..9e778b3eed281ff823ece52e46393c109760acbd 100644 --- a/p1/p1.ipynb +++ b/p1/p1.ipynb @@ -1,235 +1,172 @@ { "cells": [ { - "cell_type": "raw", - "id": "aac30aec", - "metadata": {}, + "cell_type": "code", + "execution_count": null, + "id": "d7687212", + "metadata": { + "cell_type": "code", + "deletable": false, + "editable": false + }, + "outputs": [], "source": [ - "# ASSIGNMENT CONFIG\n", - "solutions_pdf: true\n", - "export_cell:\n", - " instructions: \"SUBMISSION INSTRUCTIONS: The zipfile automatically gets downloaded. You should have received GradeScope invite - please accept it. Login to GradeScope and upload the zipfile. Check otter results as soon as auto-grader gets completed.\"\n", - " pdf: false\n", - "generate: true" + "# import and initialize otter\n", + "import otter\n", + "grader = otter.Notebook(\"p1.ipynb\")" ] }, { "cell_type": "code", "execution_count": null, - "id": "4874d9e2", - "metadata": {}, + "id": "5a9e68fd", + "metadata": { + "deletable": false + }, "outputs": [], "source": [ "# PLEASE FILL IN THE DETAILS\n", - "# Enter None if you don't have a project partner\n", + "# Enter none if you don't have a project partner\n", "\n", "# project: p1\n", "# submitter: NETID1\n", - "# partner: NETID2\n", + "# partner: none\n", "# hours: ????" ] }, - { - "cell_type": "raw", - "id": "97ac2d11", - "metadata": {}, - "source": [ - "# BEGIN QUESTION\n", - "name: q1\n", - "points: 12.5" - ] - }, { "cell_type": "markdown", - "id": "2fc08f81", - "metadata": {}, + "id": "1f7148e8", + "metadata": { + "deletable": false, + "editable": false + }, "source": [ "**Question 1:** \"Hello, World!\" program." ] }, - { - "cell_type": "raw", - "id": "6add9af9", - "metadata": {}, - "source": [ - "# BEGIN SOLUTION" - ] - }, { "cell_type": "code", - "execution_count": 1, - "id": "4751a35d", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'Hello, World!'" - ] - }, - "execution_count": 1, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "id": "2506ec80", + "metadata": { + "tags": [] + }, + "outputs": [], "source": [ "name = \"World\"\n", "greeting = \"Hello, \" + name + \"!\"\n", + "\n", "greeting" ] }, - { - "cell_type": "raw", - "id": "5eba2a1d", - "metadata": {}, - "source": [ - "# END SOLUTION" - ] - }, - { - "cell_type": "raw", - "id": "a20f4709", - "metadata": {}, - "source": [ - "# BEGIN TESTS" - ] - }, { "cell_type": "code", - "execution_count": 2, - "id": "583a6998", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "greeting == \"Hello, World!\"" - ] - }, - { - "cell_type": "raw", - "id": "e070cc78", - "metadata": {}, - "source": [ - "# END TESTS" - ] - }, - { - "cell_type": "raw", - "id": "b12d2b8c", - "metadata": {}, - "source": [ - "# END QUESTION" - ] - }, - { - "cell_type": "raw", - "id": "3d166bde", - "metadata": {}, + "execution_count": null, + "id": "49586bd4", + "metadata": { + "deletable": false, + "editable": false + }, + "outputs": [], "source": [ - "# BEGIN QUESTION\n", - "name: q2\n", - "points: 12.5" + "grader.check(\"q1\")" ] }, { "cell_type": "markdown", - "id": "e6847d06", - "metadata": {}, + "id": "462bcd1f", + "metadata": { + "deletable": false, + "editable": false + }, "source": [ "**Question 2:** Compute current year." ] }, - { - "cell_type": "raw", - "id": "d6438b98", - "metadata": {}, - "source": [ - "# BEGIN SOLUTION" - ] - }, { "cell_type": "code", - "execution_count": 3, - "id": "5c9d59fe", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "2022" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "id": "fdbb5e85", + "metadata": { + "tags": [] + }, + "outputs": [], "source": [ - "curr_year = 45 * 45 - 3\n", + "curr_year = 45 * 45 - 2\n", + "\n", "curr_year" ] }, { - "cell_type": "raw", - "id": "8b76d9b8", - "metadata": {}, + "cell_type": "code", + "execution_count": null, + "id": "f431b8b4", + "metadata": { + "deletable": false, + "editable": false + }, + "outputs": [], "source": [ - "# END SOLUTION" + "grader.check(\"q2\")" ] }, { - "cell_type": "raw", - "id": "f5bd1815", - "metadata": {}, + "cell_type": "markdown", + "id": "f1397ae4", + "metadata": { + "deletable": false, + "editable": false + }, "source": [ - "# BEGIN TESTS" + "## Submission\n", + "Now, click on `Kernel` -> `Restart & Run All` to run all the cells in the notebook.\n", + "The cells below will automatically save your notebook after the previous cells are run, and generate a zip file for you to submit.\n", + "\n", + "**SUBMISSION INSTRUCTIONS**:\n", + "The zipfile automatically gets downloaded. You should have received a GradeScope invite - please accept it.\n", + "Login to GradeScope and upload the zipfile. Check otter results as soon as auto-grader gets completed." ] }, { "cell_type": "code", - "execution_count": 4, - "id": "7fe0d9eb", - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "execution_count": null, + "id": "49cef762", + "metadata": { + "cell_type": "code", + "deletable": false, + "editable": false + }, + "outputs": [], "source": [ - "curr_year == 2022" + "# running this cell will create a new save checkpoint for your notebook\n", + "from IPython.display import display, Javascript\n", + "display(Javascript('IPython.notebook.save_checkpoint();'))" ] }, { - "cell_type": "raw", - "id": "34e6a864", - "metadata": {}, + "cell_type": "code", + "execution_count": null, + "id": "f0f8872d", + "metadata": { + "cell_type": "code", + "deletable": false, + "editable": false + }, + "outputs": [], "source": [ - "# END TESTS" + "grader.export(pdf=False, run_tests=True)" ] }, { - "cell_type": "raw", - "id": "e42b2d01", - "metadata": {}, + "cell_type": "markdown", + "id": "67c217c2", + "metadata": { + "deletable": false, + "editable": false + }, "source": [ - "# END QUESTION" + " " ] } ], @@ -249,7 +186,50 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.12" + "version": "3.9.13" + }, + "otter": { + "OK_FORMAT": true, + "tests": { + "q1": { + "name": "q1", + "points": 12.5, + "suites": [ + { + "cases": [ + { + "code": ">>> greeting == \"Hello, World!\"\nTrue", + "hidden": false, + "locked": false + } + ], + "scored": true, + "setup": "", + "teardown": "", + "type": "doctest" + } + ] + }, + "q2": { + "name": "q2", + "points": 12.5, + "suites": [ + { + "cases": [ + { + "code": ">>> curr_year == 2023\nTrue", + "hidden": false, + "locked": false + } + ], + "scored": true, + "setup": "", + "teardown": "", + "type": "doctest" + } + ] + } + } } }, "nbformat": 4,