[Tutor] Creating Table

Danny Yoo dyoo at hashcollision.org
Wed Nov 12 22:42:43 CET 2014


On Wed, Nov 12, 2014 at 11:33 AM,  <niyanaxx95 at gmail.com> wrote:
> Create a table based on two user inputs.  Have the user enter two integers
> between 2 and 6.  Validate the user inputs are in the proper range as they
> are entered.  The first integer represents the number of rows in the table.
> The second integer represents the number of columns.
> Create the table by storing the value (i **j) in each cell in the table.
> Print the Power table with a column header separated from the table by a
> line of underscores (“_”) and a row header that lists the row number, a “|”
> and the row of data.
>
> This is what I have. I am very confused on what to do.

[code cut]

Hi Niyana,

We need to pinpoint where you're getting confused.  I get confused for
all sorts of different reasons myself, so forgive me if this sounds
really basic.   :P

I will ignore your code entirely for the moment.

Do you know what the output is supposed to look like for small inputs?

  * What should the program output look like when rows=2 and columns=2?
  * What should the program output look like when rows=2 and columns=3?
  * What should the program output look like when rows=3 and columns=2?

The inputs are small enough that you should be able to write what you
know the program should do, even before trying to teach the computer
how to do it.

Let's make sure we understand the problem we're trying to solve before
rushing to code it.


More information about the Tutor mailing list