代码如下:
1 import random
2
3 n = int(input("请输入行:"))
4 m = int(input("请输入列:"))
5 x = y = 0
6 while x < n:
7 y = 0
8 while y < m:
9 print(random.randint(1, 100), end=" ")
10 y += 1
11 print()
12 x += 1
运行结果:
代码如下:
1 import random
2
3 n = int(input("请输入行:"))
4 m = int(input("请输入列:"))
5 x = y = 0
6 while x < n:
7 y = 0
8 while y < m:
9 print(random.randint(1, 100), end=" ")
10 y += 1
11 print()
12 x += 1
运行结果: