修改列表的元素时,可以使用for 循环结合range
n = int(input())
list_b = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
for i in range(len(list_b)): for y in range(len(list_b[i])): list_b[i][y] = list_b[i][y]*n
print(list_b)