I have a list and a nested list in python that I want to combine. An example of the problem is below:
list_1 = [[[1,2,3],[4,5,6],[7,8,9]],[[10,11,12],[13,14,15],[16,17,18]],[[19,20,21],
[22,23,24],[25,26,27]]]
list_2 = ['23.43', '24.56', '25.78']
I want to combine the two list so I get the following result:
result = [['23.43',[1,2,3],[4,5,6],[7,8,9]],['24.56',[10,11,12],[13,14,15],[16,17,18]],
['25.78',[19,20,21],[22,23,24],[25,26,27]]]
I tried the following:
result = map(list.__add__, list_2, list_1)
But i got the following error:
TypeError: descriptor '__add__' requires a 'list' object but received a 'float'
I was wondering if there was a better way to approach this problem.