Skip to main content

Notation Answer Key

Practice calibration​

  1. g(0) = 2, g(4) = 14; -1 is outside the specified nonnegative domain.
  2. Length 0 has no valid indexes; length 4 has 0, 1, 2, 3. Counting four positions from zero ends at 3.
  3. All three statements are true. The list has two entries; the set has one member. This distinction matters when repetitions are events rather than accidental duplication.
  4. 2 × 1 + 2 × 2 + 2 × 3 = 12. Initialize a total to zero; use for i in range(1, 4) and add 2 * i.
  5. For example, 1 is positive and odd. A finite selection of even examples does not cover every positive integer.

Exit calibration​

A. Multiply the allowed input by 2 and add 4; h(3) = 10. Inputs are 0, 1, 2, and so on.

B. Length 2 permits 0 and 1. An empty array permits none; attempting index 0 is not valid merely because it is the first index in a nonempty array.

C. 2 + 3 + 4 = 9. Use range(2, 5) so Python visits the inclusive mathematical endpoint 4.

D. Each file may have a different backup location in the first claim. For example, file A is backed up only at location X, and file B only at location Y; then each file has a backup location but no single location holds both. The second claim requires such a common location.

E. Two 20-minute sessions represent 40 minutes. The set with the sole member 20 loses multiplicity, so summing it gives 20. A list retains the two events.

These are calibration outlines. A correct equivalent explanation or loop is acceptable. If you consulted this key first, demonstrate a new variant before recording independence.