I am new to python trying to understand how parameters are passed in Python.
It shows everywhere that Python passes arguments by assignment.I am trying to compare it with Java.
How does it differ? It seems the same to me where everything is passed by value. Even in the case of references, it creates a copy of references and modification is done through it. I want to understand how it differs from Java.
I have attached a program where I was trying to understand how things are working out. It does the same even in Java.
def change(originalReferencecopy):
originalReferencecopy.append(45)
originalReferencecopy=[21, 44, 66, 89]
print(originalReferencecopy)
#output is [21, 44, 66, 89]
if __name__ == '__main__':
original=[1,2,3,4,5]
change(original)
print(original)
#output is [1, 2, 3, 4, 5, 45]
I want to understand the control flow of how things are working out for the above-mentioned program in python and java.