points 1 =[1219.5537056928035, [1318.8861439312564, 1214.6746106337268,
1110.4630773361973, 1006.2515440386678, 902.0400107411383]]
For the above list, I want to create ordered pairs, by considering points 1[0] as X-axis and points 1[1] as Y-axis. example:
[(1219.553,1318.88),(1219.553,1214.674), (1219.553,1110.465)...................
list(zip(itertools.repeat(points1[0],points1[1])))
I am trying using zip, but getting error:
'list' object cannot be interpreted as an integer
You can use itertools.product
here.
list(itertools.product([points1[0]],points1[1]))
[(1219.5537056928035, 1318.8861439312564),
(1219.5537056928035, 1214.6746106337268),
(1219.5537056928035, 1110.4630773361973),
(1219.5537056928035, 1006.2515440386678),
(1219.5537056928035, 902.0400107411383)]
For the error you got. The signature of itertools.repeat
is
itertools.repeat(object[, times])
Where times
takes integers as an argument and you gave it a list.