|
2 | 2 | "cells": [ |
3 | 3 | { |
4 | 4 | "cell_type": "code", |
5 | | - "execution_count": null, |
| 5 | + "execution_count": 2, |
6 | 6 | "metadata": { |
7 | 7 | "deletable": false, |
8 | 8 | "editable": false |
|
36 | 36 | }, |
37 | 37 | { |
38 | 38 | "cell_type": "code", |
39 | | - "execution_count": null, |
| 39 | + "execution_count": 3, |
40 | 40 | "metadata": {}, |
41 | 41 | "outputs": [], |
42 | 42 | "source": [ |
|
68 | 68 | "otter_answer_cell" |
69 | 69 | ] |
70 | 70 | }, |
71 | | - "outputs": [], |
| 71 | + "outputs": [ |
| 72 | + { |
| 73 | + "ename": "AssertionError", |
| 74 | + "evalue": "", |
| 75 | + "output_type": "error", |
| 76 | + "traceback": [ |
| 77 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 78 | + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", |
| 79 | + "Cell \u001b[0;32mIn[4], line 12\u001b[0m\n\u001b[1;32m 9\u001b[0m data_file_name \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m.\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;241m.\u001b[39m\n\u001b[1;32m 11\u001b[0m \u001b[38;5;66;03m# This is what the autograder will check\u001b[39;00m\n\u001b[0;32m---> 12\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m data_file_name \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata1.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m\n", |
| 80 | + "\u001b[0;31mAssertionError\u001b[0m: " |
| 81 | + ] |
| 82 | + } |
| 83 | + ], |
72 | 84 | "source": [ |
73 | 85 | "# GUIDE: Create a string from the following variables\n", |
74 | 86 | "\n", |
|
80 | 92 | "# GUIDE: replace ... with string creation\n", |
81 | 93 | "data_file_name = ...\n", |
82 | 94 | "\n", |
| 95 | + "print(f\"{data_file_name}, {da}\")\n", |
83 | 96 | "# This is what the autograder will check\n", |
84 | 97 | "assert data_file_name == \"data1.csv\"" |
85 | 98 | ] |
|
119 | 132 | }, |
120 | 133 | { |
121 | 134 | "cell_type": "code", |
122 | | - "execution_count": null, |
| 135 | + "execution_count": 5, |
123 | 136 | "metadata": { |
124 | 137 | "deletable": false, |
125 | 138 | "editable": false |
126 | 139 | }, |
127 | | - "outputs": [], |
| 140 | + "outputs": [ |
| 141 | + { |
| 142 | + "data": { |
| 143 | + "text/html": [ |
| 144 | + "<p><strong style='color: red;'><pre style='display: inline;'>Strings</pre> results:</strong></p><p><strong><pre style='display: inline;'>Strings - 1</pre> result:</strong></p><pre> ❌ Test case failed\n", |
| 145 | + " Trying:\n", |
| 146 | + " assert data_file_name == 'data1.csv'\n", |
| 147 | + " Expecting nothing\n", |
| 148 | + " **********************************************************************\n", |
| 149 | + " Line 1, in Strings 0\n", |
| 150 | + " Failed example:\n", |
| 151 | + " assert data_file_name == 'data1.csv'\n", |
| 152 | + " Exception raised:\n", |
| 153 | + " Traceback (most recent call last):\n", |
| 154 | + " File \"/opt/anaconda3/lib/python3.12/doctest.py\", line 1368, in __run\n", |
| 155 | + " exec(compile(example.source, filename, \"single\",\n", |
| 156 | + " File \"<doctest Strings 0[0]>\", line 1, in <module>\n", |
| 157 | + " assert data_file_name == 'data1.csv'\n", |
| 158 | + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", |
| 159 | + " AssertionError\n", |
| 160 | + "</pre><p><strong><pre style='display: inline;'>Strings - 2</pre> result:</strong></p><pre> ❌ Test case failed\n", |
| 161 | + " Trying:\n", |
| 162 | + " assert new_file_name == 'fname1.csv'\n", |
| 163 | + " Expecting nothing\n", |
| 164 | + " **********************************************************************\n", |
| 165 | + " Line 1, in Strings 1\n", |
| 166 | + " Failed example:\n", |
| 167 | + " assert new_file_name == 'fname1.csv'\n", |
| 168 | + " Exception raised:\n", |
| 169 | + " Traceback (most recent call last):\n", |
| 170 | + " File \"/opt/anaconda3/lib/python3.12/doctest.py\", line 1368, in __run\n", |
| 171 | + " exec(compile(example.source, filename, \"single\",\n", |
| 172 | + " File \"<doctest Strings 1[0]>\", line 1, in <module>\n", |
| 173 | + " assert new_file_name == 'fname1.csv'\n", |
| 174 | + " ^^^^^^^^^^^^^\n", |
| 175 | + " NameError: name 'new_file_name' is not defined. Did you mean: 'data_file_name'?\n", |
| 176 | + "</pre>" |
| 177 | + ], |
| 178 | + "text/plain": [ |
| 179 | + "Strings results:\n", |
| 180 | + " Strings - 1 result:\n", |
| 181 | + " ❌ Test case failed\n", |
| 182 | + " Trying:\n", |
| 183 | + " assert data_file_name == 'data1.csv'\n", |
| 184 | + " Expecting nothing\n", |
| 185 | + " **********************************************************************\n", |
| 186 | + " Line 1, in Strings 0\n", |
| 187 | + " Failed example:\n", |
| 188 | + " assert data_file_name == 'data1.csv'\n", |
| 189 | + " Exception raised:\n", |
| 190 | + " Traceback (most recent call last):\n", |
| 191 | + " File \"/opt/anaconda3/lib/python3.12/doctest.py\", line 1368, in __run\n", |
| 192 | + " exec(compile(example.source, filename, \"single\",\n", |
| 193 | + " File \"<doctest Strings 0[0]>\", line 1, in <module>\n", |
| 194 | + " assert data_file_name == 'data1.csv'\n", |
| 195 | + " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", |
| 196 | + " AssertionError\n", |
| 197 | + "\n", |
| 198 | + " Strings - 2 result:\n", |
| 199 | + " ❌ Test case failed\n", |
| 200 | + " Trying:\n", |
| 201 | + " assert new_file_name == 'fname1.csv'\n", |
| 202 | + " Expecting nothing\n", |
| 203 | + " **********************************************************************\n", |
| 204 | + " Line 1, in Strings 1\n", |
| 205 | + " Failed example:\n", |
| 206 | + " assert new_file_name == 'fname1.csv'\n", |
| 207 | + " Exception raised:\n", |
| 208 | + " Traceback (most recent call last):\n", |
| 209 | + " File \"/opt/anaconda3/lib/python3.12/doctest.py\", line 1368, in __run\n", |
| 210 | + " exec(compile(example.source, filename, \"single\",\n", |
| 211 | + " File \"<doctest Strings 1[0]>\", line 1, in <module>\n", |
| 212 | + " assert new_file_name == 'fname1.csv'\n", |
| 213 | + " ^^^^^^^^^^^^^\n", |
| 214 | + " NameError: name 'new_file_name' is not defined. Did you mean: 'data_file_name'?" |
| 215 | + ] |
| 216 | + }, |
| 217 | + "execution_count": 5, |
| 218 | + "metadata": {}, |
| 219 | + "output_type": "execute_result" |
| 220 | + } |
| 221 | + ], |
128 | 222 | "source": [ |
129 | 223 | "grader.check(\"Strings\")" |
130 | 224 | ] |
|
353 | 447 | "name": "python", |
354 | 448 | "nbconvert_exporter": "python", |
355 | 449 | "pygments_lexer": "ipython3", |
356 | | - "version": "3.11.7" |
| 450 | + "version": "3.12.4" |
357 | 451 | }, |
358 | 452 | "otter": { |
359 | 453 | "OK_FORMAT": true, |
|
0 commit comments