x = ['foo', 'bar']for index, y in enumerate(x): if y == 'bar': x[index] = 'qwerty' print(x)
Standard input is empty
['foo', 'qwerty']
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!