Consider the following lines of Python code.
x = [589,'big',397,'bash']
y = x[2:]
u = x
w = y
w = w[0:]
w[0] = 357
x[2:3] = [487]
Output of the code line by line will be
x = [589,'big',397,'bash']
y = x[2:]
# output: [397, 'bash']
u = x
# output: [589, 'big', 397, 'bash']
w = y
# output: [397, 'bash']
w = w[0:]
# output: [397, 'bash']
w[0] = 357
# output: 357
x[2:3] = [487]
# output: [487]
Comments
Leave a comment