def inplace(a: list): for i in range(0, len(a) - len(a) % 2, 2): a[i], a[i + 1] = a[i + 1], a[i] for upper in (10, 11): a = list(range(1, upper)) aa = a.copy() inplace(aa) print(aa)
Standard input is empty
[2, 1, 4, 3, 6, 5, 8, 7, 9] [2, 1, 4, 3, 6, 5, 8, 7, 10, 9]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!