I have two lists and want to merge them. At the moment I am using wo for loops but for sure there are more efficient ways and I do appreciate your help. These are my lists:
big_list=[[0.0, 4.0],[2.0, 5.0],[1.0, 1.0]]
small_list=[7.0, 9.0, 35.0]
both lists have the same lengths. In reality they are much more bigger. Then, I want concatenate the first sublist of the big_list with first value of small_list. Length of all sublists of big_list are the same and they are always 2. Then I go for the next following sublists and values to have:
[[0.0, 4.0, 7.0],[2.0, 5.0, 9.0],[1.0, 1.0, 35.0]]
I tried the following code but I think there are faster and more efficient way to do it:
first_list=[]
for i in range (len(big_list)):
arrange=[matches[i], seg_lines[i]]
first_list.append(arrange)
final_list=[]
for i in first_list:
new=[i[0][0], i[0][1], i[1]]
final_list.append(new)
in advance, I appreciate any help.