In this article, we have explored how to pass a variable by reference to a function in Python. We have demonstrated the ideas by Python code snippets.
There a two types of passing parameters to a function in Python:
Pass By Value
Pass By Reference
Pass By Value:
A copy of the argument passed to the function is made and when any operation is done on the copy the actual value does not change. It only changes the value of the copy which is made inside the function.
def fun(a):
a+=10
print...
Published on October 16, 2020 00:07