x=[2,4,6,8,10] neighbours = {x1:(x0,x2) for (x0,x1,x2) in zip(x[:-2],x[1:-1],x[2:])} print(neighbours)
Standard input is empty
{8: (6, 10), 4: (2, 6), 6: (4, 8)}
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!