call by reference in python by R4R Team

Call by refrence-
- call by refrence is a concept in which we call a function and pass the refrence of the variable.


def function(l):
for i in range(len(l)):
print("list inside function",l)

print("Enter number in list")
print("Given List is",l)
print("List after function calling",l)


Enter number in list
1 2 3 4 5
Given List is [1, 2, 3, 4, 5]
list inside function [0, 0, 0, 0, 0]
List after function calling [0, 0, 0, 0, 0]

-In this program, we take a input of list and pass in the function by 'call by refrence' and change the content of the list inside function reflect the change in actual list as shown in above program and output.

Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!