Skip to content

Commit 6abf8dc

Browse files
Remove image for text for accessibility
1 parent 3dee0ef commit 6abf8dc

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Binary file not shown.

short_courses/python_language_features.ipynb

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,23 @@
174174
"\n",
175175
"Copy the following code fragment into your IDE. If type checking is enabled you should see a warning message.\n",
176176
"\n",
177-
"![Screenshot of a Python code snippet in Visual Studio Code showing type hints and type checking errors. A dictionary word_countis annotated asdict[str, int]. Assigning a string key 'the'with integer value1is valid, but assigning an integer key2with a string value'error' triggers type errors. The editor highlights mismatched key and value types using Pylance.](figures/python_testing/type-checking.png)\n",
177+
"```python\n",
178+
"word_count: \"dict[str,int]\" = {}\n",
179+
"\n",
180+
"word_count['the'] = 1\n",
181+
"word_count[2] = 'error'\n",
182+
"```\n",
183+
"\n",
184+
"```\n",
185+
"Argument of type \"Literal[2]\" cannot be assigned to parameter \"key\" of type \"str\" in function \"__setitem__\"\n",
186+
" \"Literal[2]\" is incompatible with \"str\" Pylance(reportArgumentType)\n",
187+
"\n",
188+
"Argument of type \"Literal['error']\" cannot be assigned to parameter \"value\" of type \"int\" in function \"__setitem__\"\n",
189+
" \"Literal['error']\" is incompatible with \"int\" Pylance(reportArgumentType)\n",
190+
"\n",
191+
"(variable) word_count: dict[str, int]\n",
192+
"```\n",
193+
"\n",
178194
"\n",
179195
"Without making any changes, try running the code."
180196
]

0 commit comments

Comments
 (0)