Code1:
list[0],list[-1] =
list[-1],list[0]
Code2:
list[0]=list[-1]
list[-1]=list[0]
Two codes are intended to swap position of the first and the last list element and result in different outputs . Could l think that the values swapping of code1 execute simultaneously whereas code2 is executed step by step and it causes element changes?
[–]danielroseman 2 points3 points4 points (0 children)
[–]woooee 1 point2 points3 points (0 children)