import random
def shuerte():
a = random.randint(1, 25)
nums = list()
nums.append(a)
while True:
i = 0
a = random.randint(1, 25)
for num in nums:
if num == a:
i = 1
break
if i == 0:
nums.append(a)
if len(nums) == 25:
break
return nums
def shuerte_zu():
a, b = shuerte(), shuerte()
i, j = 0, 0
for a1 in a:
print(a1, end="\t")
i += 1
if i % 5 == 0:
print(end="\t")
for b1 in b:
print(b[j], end="\t")
j += 1
if j % 5 == 0:
print()
break
def main():
zu = int(input("请输入要生成的组数:"))
while zu:
shuerte_zu()
print()
zu -= 1
if __name__ == '__main__':
main()
以下数据随机生成
运行结果:
请输入要生成的组数:6
3 6 1 18 15 6 4 15 1 11
20 17 10 14 23 24 23 10 19 22
12 16 25 5 13 2 5 12 8 21
19 21 8 9 24 14 3 17 25 9
2 11 4 22 7 18 7 16 13 20
2 4 15 24 5 21 25 3 16 19
25 23 22 17 9 14 12 13 2 5
13 14 21 7 19 15 11 9 23 1
6 8 20 3 18 17 22 7 24 6
16 10 1 11 12 20 10 18 8 4
9 23 10 17 1 3 15 19 12 10
5 14 25 4 11 23 1 25 8 13
7 2 6 3 16 21 6 7 17 22
8 20 12 13 19 24 11 14 20 2
21 22 15 18 24 4 18 9 5 16
7 23 19 10 21 25 21 17 6 3
13 8 17 5 24 7 8 9 19 1
22 16 14 11 3 12 20 4 24 14
18 4 9 20 15 15 2 11 23 16
1 12 25 2 6 18 22 13 5 10
25 3 8 4 11 22 20 25 11 21
13 14 23 6 9 16 2 17 12 15
12 24 1 10 22 19 23 3 7 24
2 5 7 18 21 14 1 9 5 13
17 15 20 19 16 18 4 6 8 10
14 17 8 12 15 24 13 12 6 15
25 6 2 7 22 4 11 10 21 22
3 20 1 19 9 17 2 18 8 9
11 24 4 5 23 25 19 1 14 5
10 18 16 13 21 3 16 23 7 20
Process finished with exit code 0
转载于:https://blog.51cto.com/14188396/2346771