Skip to main content
Contents Index
Search Book
Search Results:
No results.
Readability settings Prev Up Next Scratch ActiveCode Profile
title here
\(
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Section 11.9 Debugging
Lists, dictionaries and tuples are known generically as
data structures . In this chapter, we have started to see
compound data structures, like lists of tuples and dictionaries with tuples as keys and lists as values.
Compound data structures are useful, but they are prone to
shape errors ; that is, errors caused when a data structure has the wrong type, size, or composition, or perhaps you write some code and forget the shape of your data and introduce an error. For example, if you are expecting a list containing one integer and I just give you an integer that isn’t in a list, it won’t work.
Activity 11.9.1 .
11-9-1: When an error is present in your code, what should you do to help discover the bug?
Read, retreat, run, ruminate
Correct! As shown in Chapter 1, these are the best ways to go about discovering bugs in your code.
Read, google, run, ruminate
Incorrect! While Google is very useful for programmers, it’s not one of the debugging steps we reviewed in Chapter 1. Try again.
Email your GSI for help
Incorrect! While you can always reach out to your GSI with questions, always make sure to first try and find the bug yourself. Try again.
Activity 11.9.2 .
11-9-2: A(n) ________ is an error that is caused when a data structure has the wrong type, size, or composition.
Activity 11.9.3 .
11-9-3: Which of the following are examples of compound data structures? (Select all that apply)
Lists of tuples
Correct! Lists of tuples are a type of compound data structure.
Lists
Incorrect! Lists are a type of data structure, but a list by itself isn’t compound. Try again.
Tuples
Incorrect! Tuples are a type of data structure, but a tuple by itself isn’t compound. Try again.
Dictionaries with tuples for keys
Correct! A dictionary with tuples for keys is another type of compound data structure.
You have attempted
of
activities on this page.