a = [1, 2, 2, 3, 4, 5, 5]for i in range(1, len (a), 2): print(i, a[i] == a[i-1], a[i] == a[i+1])
Standard input is empty
1 False True 3 False False 5 False True
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!