# Make pairs of letters
pairs = zip('LEAST', 'HDKEN')
# Sort pairs, using the index into STEAL as the sort key
sortedpairs = sorted(pairs, key=lambda s:'STEAL'.index(s[0]))
# Unzip the pairs back into words
result = zip(*sortedpairs)
# Print the words
print ''.join(result[0]), ''.join(result[1])
把这两条线拉在一起,这样你就可以把成对的字母排序了。然后排序,然后解压缩
或者,再长一点:
(根据需要打印
STEAL ENDKH
)相关问题 更多 >
编程相关推荐