Suppose we are given a list X of integer arguments of some function and a list Y of integer values of this function of the same size as X . We need to construct a sequence of pairs corresponding the square of this function, i.e., (X[0],Y[0]2),(X[1],Y[1]2),…
Hint USE ZIP
from typing import Iterator
X = [1,2,3]
Y = [5,6,7]
S : Iterator[tuple[int, int]] = YOUR_EXPRESSION
assert set(S)=={(1,25), (2,36), (3,49)}
My solution is the following below. However, it does not use zip. Can someone rewrite with the zip function?
S = { (X[i], Y[i]**2) for i in range(len(X)) }