1,2,3,4随机取出三个数,组成三位数,不能重复,三位数里不能有一样的

def get_three():
lis = []
for i in range(1, 5):
for j in range(1, 5):
for k in range(1, 5):
if i != j and j != k and k != i:
res = '%s%s%s' % (i, j, k)
lis.append(res)
print('这个数组的长度是%s,包含的元素有%s' % (len(lis), lis))
get_three()

猜你喜欢

转载自www.cnblogs.com/laosun0204/p/9966515.html