1If the object is mutable, the object will change.
2
3eg:
4 def my_func(my_list):
5 my_list.append(5)
6 print("List printed inside the function: ",my_list)
7
8numberlist = [1,2,3]
9my_func(numberlist)
10# numberlist here changed since list is mutable in python
11
12If the object is immutable (like a string!),
13then a new object is formed, only to live within the function scope.
14
15eg:
16 def change_fruits(fruit):
17 fruit='apple'
18
19myfruit = 'banana'
20change_fruits(myfruit)
21# myfruit does not change since string is immutable in python
22