57 Program for overwriting call by reference in Python

Program:

#call by reference,overwriting the reference

def display(list):

    list=[1,2,3,4,5]

    print(list)

    print(id(list))

list = [10,20,30,40,50]

print(list)

display(list)  #function call

print(list)

print(id(list))


Output:

Program for overwriting call by reference in Python

Previous
Next Post »