Hi, good effort so far! I'm going to try to walk through a solution here-- feel free to message me or reply if anything is unclear.
Setting up our nested loops
In this problem, we should only need two loops, as the purpose is to print a 2-Dimensional grid. The assignment description may be a bit confusing in it's wording, but it is intending for us to use a single pair of loops (with one loop nested in the other)
Also note that the range statement must be changed to: range(1, 7). This is because we want to output exactly 6 rows and exactly 6 columns in our output. The range() function is not inclusive of the upper-bound value, which is why we specify the upper-bound as "7" instead of "6".
To be crystal clear, range(1, 7) returns an iterable containing the values: 1, 2, 3, 4, 5, 6
Putting that all together, our starting code may look something like this (ignore the "pass"-- it is a placeholder for the code we are going to write next)
for i in range(1, 7):
for j in range(1, 7):
pass
Constructing rows
There are a few ways we can go about this, but a solution I like for its cleanliness is creating a variable within the FIRST loop to keep track of row data
Our inner loop's job will be to keep adding individual numbers to this variable until it contains 6 numbers in string format (so we can print it out)
For every iteration of our outer for loop, row will change accordingly:
i = 1, row = '123456'
i = 2, row = '24681012'
i = 3, row = '369121518'
... etc.
Note that this pattern of iteratively updating a variable via a loop until it eventually reaches a desired state (e.g. containing 6 numbers) is called the accumulator pattern.
for i in range(1, 7):
row = ''
for j in range(1, 7):
row += str(i*j)
print(row)
Formatting with 4-character-width columns
As we can see from the above example, the formatting is really ugly since we are essentially mushing all the numbers together, then printing them out. We can use the string .format() function to correctly format our data with 4-character-width columns per the assignment description as below
The format specification we need to use would be: ":>4". The colon tells python we want to specify a format, the greater-than symbol is the format code for "right-justified", and the 4 implies "4-character-wide text"
for i in range(1, 7):
row = ''
for j in range(1, 7):
row += '{:>4}'.format(i*j)
print(row)
Alternative Solution
An alternative solution, similar to the one you were working on, might be as follows.
This works just as well, and eliminates the need for a "row" variable by telling the print function to not move to the next line. After the inner loop finishes, we add a blank print statement to manually add a new line between rows.
for i in range(1, 7):
for j in range(1, 7):
print('{:>4}'.format(i*j)', end='')
print()