本帖最后由 headjean2008 于 2018-3-17 15:09 编辑 list1 = [1,5,3,9,7,8]
list2 =[]
a,b,c = [0,0,0]
num = 0
count = range(len(list1))
for a in count:
for b in count:
for c in count:
while a!=b and a!=c and b!=c:
num = list1[a]*100+list1[b]*10+list1[c]
list2.append(num)
break
print(list2)
print('长度为:',len(list2))
[153, 159, 157, 158, 135, 139, 137, 138, 195, 193, 197, 198, 175, 173, 179, 178, 185, 183, 189, 187, 513, 519, 517, 518, 531, 539, 537, 538, 591, 593, 597, 598, 571, 573, 579, 578, 581, 583, 589, 587, 315, 319, 317, 318, 351, 359, 357, 358, 391, 395, 397, 398, 371, 375, 379, 378, 381, 385, 389, 387, 915, 913, 917, 918, 951, 953, 957, 958, 931, 935, 937, 938, 971, 975, 973, 978, 981, 985, 983, 987, 715, 713, 719, 718, 751, 753, 759, 758, 731, 735, 739, 738, 791, 795, 793, 798, 781, 785, 783, 789, 815, 813, 819, 817, 851, 853, 859, 857, 831, 835, 839, 837, 891, 895, 893, 897, 871, 875, 873, 879]
长度为: 120 |