Check your understanding of the primer: lists of dataclasses, nested dataclasses, nested lists, and heavily nested data.

Question 1

Which of the following is an advantage of nesting dataclasses inside of lists?

Select one answer, then check.

  • Correct. The primer compares a list of dataclasses to "a table or spreadsheet," since each element shares the same attributes but holds distinct values.
  • Not quite, this is a cost of nesting, not an advantage.
  • Not quite. The primer never compares the two directions of nesting; both are covered as equally normal combinations.
  • Not quite. The primer says each element "has the same type of attributes," only the values differ between instances.

Question 2

How does one index a specific element in a nested list?

Select one answer, then check.

  • Correct. The primer says indexing a specific element in a nested list "requires chaining together two indexes," as in numbers_2d[1][2].
  • Not quite. That describes dictionary-style lookup, not list indexing, which uses integer positions.
  • Not quite. in tests membership (whether a value appears in the list); it does not retrieve an element by position.
  • Not quite. Nested-list indexing is just two ordinary indexes in a row, nothing is partitioned or rotated.

Question 3

What is the main advantage of heavily nested data?

Select one answer, then check.

  • Correct. The primer's closing section says "by doing so, we can represent truly complex data," at the cost of more nested control structures and attribute accesses.
  • Not quite, this is not a real property the primer describes.
  • Not quite. A dataclass itself is not something you loop over; you iterate over the lists that hold dataclass instances.
  • Not quite, this is a joke option, not a stated advantage.