有四个数字:1,2,3,4, 能组成多少个互补相同且无重复数字的三位数?各是多少?
li = [1, 2, 3, 4]
n = 0
for x in li:
for y in li:
for z in li:
if x != y and x != z and y != z:
n += 1
print("%d%d%d" % (x, y, z))
print("共循环%d次" % n)
有四个数字:1,2,3,4, 能组成多少个互补相同且无重复数字的三位数?各是多少?
li = [1, 2, 3, 4]
n = 0
for x in li:
for y in li:
for z in li:
if x != y and x != z and y != z:
n += 1
print("%d%d%d" % (x, y, z))
print("共循环%d次" % n)