I am quite new to python and am attempting to trace this simple program. I want to improve my ability to look at code and understand what the output will be.
To be honest I am just starting to study for a intro python final exam and am having trouble in the course. If anyone knows of any good concise resources on intro python they've used in the past that would be of great help as well.
Here is the program.
def fun(x):
x[0] = 0
x = [4,5,6]
return x
def main():
y = [1,2,3]
z = fun(y)
print("z =",z)
print("y =",y)
main()
so basically I want someone to explain why the output is this:
z = [4, 5, 6]
y = [0, 2, 3]