org_list = [4,6,78,21,3,32]new_list = [item if(item == idx) else item+1 for idx, item in enumerate(org_list)]print (new_list)
Standard input is empty
[5, 7, 79, 22, 4, 33]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!