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AAAASUVORK5CYII=各位大佬,比如我有【A,B,C,D,E】这样一个列表,现想得出两两元素间的距离,有什么简单易懂的方法吗?小白求指教。万分感谢


wp231957 发表于 2020-4-30 06:58:09

e到b的距离是?

麻麦皮 发表于 2020-4-30 07:36:13

str1 = input('输入:')
list1 =[]

for i in str1:
    list1.append(i)

for i in range(len(list1)):
    for j in range(i + 1, len(list1)):
      print('%c和%c的距离是%d' % (list1, list1, j - i))

#执行结果

输入:ABCDE
A和B的距离是1
A和C的距离是2
A和D的距离是3
A和E的距离是4
B和C的距离是1
B和D的距离是2
B和E的距离是3
C和D的距离是1
C和E的距离是2
D和E的距离是1

loengsan 发表于 2020-4-30 10:18:43

wp231957 发表于 2020-4-30 06:58
e到b的距离是?

e到b也是3

zltzlt 发表于 2020-4-30 13:18:48

list1 = ['A', 'B', 'C', 'D', 'E']
print('D 到 B 的距离是:', abs(list1.index('D') - list1.index('B')))
print('A 到 E 的距离是:', abs(list1.index('A') - list1.index('E')))
print('E 到 F 的距离是:', abs(list1.index('E') - list1.index('F')))

_2_ 发表于 2020-4-30 15:31:34

zltzlt 发表于 2020-4-30 13:18


简单粗暴{:10_256:}

loengsan 发表于 2020-5-1 14:32:34

麻麦皮 发表于 2020-4-30 07:36


谢谢您{:9_226:}
页: [1]
查看完整版本: 列表元素的距离