Just another way, using Cases
, DeleteElements
and Function
:
Map[Function[{y}, Join[DeleteElements[y, {_, x_} :> x], Cases[y, {_, x_} :> x]]], list]
(*{{{1, 1, 1, 1}, 0.861155}, {{1, 1, 1, 11}, 0.512393}, {{1, 1, 1, 21}, 0.410614}, {{1, 1, 1, 31}, 0.351969}}*)
Or using MapAt
:
Transpose@MapAt[#[[All, 2]] &, Transpose@list, {2}]
(*{{{1, 1, 1, 1}, 0.861155}, {{1, 1, 1, 11}, 0.512393}, {{1, 1, 1, 21}, 0.410614}, {{1, 1, 1, 31}, 0.351969}}*)
Thanks to @eldo for the following shorter version using MapAt
:
MapAt[Last, {All, 2}]@list
(*same result*)