Python
- 30 ответов
- 0 вопросов
17
Вклад в тег
l = [1, 0.6, 0.8, 0.3]
l_len = len(l)
res = [[l[abs(x-y)] for y in range(l_len)] for x in range(l_len)]
print(res) # [[1, 0.6, 0.8, 0.3], [0.6, 1, 0.6, 0.8], [0.8, 0.6, 1, 0.6], [0.3, 0.8, 0.6, 1]]
>>> for item in zip([1, 2, 3], ['sugar', 'spice', 'everything nice']):
... print(item)
...
(1, 'sugar')
(2, 'spice')
(3, 'everything nice')