https://school.programmers.co.kr/learn/courses/30/lessons/70128
>>>numbers = (1, 2, 3)
>>>letters = ("A", "B", "C")
>>>pairs = list(zip(numbers, letters))
>>>print(pairs)
[(1, 'A'), (2, 'B'), (3, 'C')]
>>>numbers, letters = zip(*pairs)
>>>numbers
(1, 2, 3)
>>>letters
('A', 'B', 'C')
>>> keys = [1, 2, 3]
>>> values = ["A", "B", "C"]
>>> dict(zip(keys, values))
{1: 'A', 2: 'B', 3: 'C'}
>>> dict(zip(["year", "month", "date"], [2001, 1, 31]))
{'year': 2001, 'month': 1, 'date': 31}
def solution(a, b):
sum=0
for i in range(len(a)):
sum+=a[i]*b[i]
return sum
def solution(a, b):
return sum([x*y for x, y in zip(a,b)])