http and apis — making the call5 / 9
parsing nested api responses — without crashing on a missing key
Cursor wrote a loop that iterates a possibly-missing tags field on
a response. To loop safely whether tags is present or not, the
default needs to be an iterable.
Fill in the default value passed to .get on line 4 so the loop
doesn't crash when tags is missing. The result for the first
response should print nothing (no tags), and the second should print
python and api on two lines.
Default value:
⌘↵ runs the editor.
Booting Python…
Output
[promptdojo:~]$ _