I was trying to solve this kind of problem, and I filled in the blanks with that thought.
But I don't know what to fill the matrix and append to print the multiplication tables as in the example.ㅠ<
Help a beginner <
python
# Correct answer required by the body
def print_gugudan():
matrix = []
for row in range(2, 10):
matrix.append([])
for column in range(1, 10):
matrix[row - 2].append(row * column)
print(matrix)
I had to organize it according to the template in the question, but it's a little awkward for me to search for an array by designating an index directly like row-2.
I feel comfortable squeezing it like below.
def print_gugudan():
matrix = []
for row in range(2, 10):
result = []
for column in range(1, 10):
result.append(row * column)
matrix.append(result)
print(matrix)
© 2025 OneMinuteCode. All rights reserved.