python调用带参函数
There are following types of function calls in python:
python中有以下类型的函数调用:
Call by value
按价值致电
Call by reference
通过参考电话
1)按价值致电 (1) Call by value )
When, we call a function with the values i.e. pass the variables (not their references), the values of the passing arguments cannot be changes inside the function.
当我们调用带有值的函数时,即传递变量(而不是它们的引用)时,传递的参数的值不能在函数内部更改。
# call by value
def change(data):
data=45
print("Inside Function :",data)
def main():
data=20
print("Before Calling :",data)
change(data)
print("After Calling :", data)
if __name__=="__main__":main()
Output