Chapter 13 Exercise: Modules (Spaces Off/Missing)

My exercise results are correct, but the spaces are missing or off when the results are printed/returned. I was wondering if anyone experienced the same thing. I attempted to add spaces, but my attempts did not match the Sanity Check image.


The printAll function as implemented in the starter code won’t produce the output shown in the sanity check.

In the starter code, they use a single tab ('\t') to space each column within each row. But the actual column headings (test names) vary from from column to column. The row headings (astronaut names) vary from row to row. So the number of tabs required to lay out a perfectly formatted table is different for each row and column. It can be calculated, but it’ll complicate the solution noticeably.

EDIT: Actully, it can be done “quick and dirty” with spaces instead of tabs:

  1. Count how wide the Name column is;
  2. Count how wide each Test column is;
  3. Pad each value with the necessary number of spaces;
  4. Don’t worry about the last column. No trailing spaces are necessary.


1 Like

It’s amazing that you were able to do that. I think I will leave it alone for now.