Try it here
Pass by reference and value

Python's parameter-passing mechanism


To pass its parameters to a function, Python uses pass-by-reference.

If you change a parameter within a function, the change reflects in the calling function. This is its default behavior.

However, when we pass literal arguments like strings, numbers, or tuples, they pass by value. This is because they are immutable.

Writer profile pic

Anmol on Apr 19, 2020 at 02:04 am

This article is contributed by Anmol. If you like and would like to contribute, you can write your article here or mail your article to . See your article appearing on the main page and help others to learn.

Post Comment

Comments( 0)




Forgot Password

Please enter your email address below and we will send you information to change your password.