Please demonstrate with a clear example on how to pass a “variable by reference in a function in PYTHON”
By Reference variable pass in PYTHON
Hello @ritvikagrawal1, you can refer to this article https://stackoverflow.com/questions/986006/how-do-i-pass-a-variable-by-reference
And pls let me know if still there is any confusion or issue.
Thanks
@A17LP0026 I too referred this link before posting doubt. But it’s more focused on List/Strings.
Even now, I’m not clear for variable (pass by reference).
Can you make it clear with help of small example.
Okay, so if we are just concerned only with the variables and not with list or strings then it is not possible to pass them as reference. In that case, if you want to change a particular value what you can do is just create a list push that no. into the list and then pass that list into the function to update the value.
And for further information, you can read this https://stackoverflow.com/questions/15148496/passing-an-integer-by-reference-in-python
I hope now it will clear to you, but still, if there is any confusion pls let me know.
Thanks