Input: two lists (list1, list2) of equal length
Output: one list (result) of the same length, such that:
result[i] = list1[i] + list2[i]
Есть какой-нибудь краткий способ сделать это? Или это лучший вариант:
# Python 3
assert len(list1) == len(list2)
result = [list1[i] + list2[i] for i in range(len(list1))]