HILLTON JNR KUFAHAKURAMBWI
PASS BY VALUE
•This is where a function creates a copy of a variable that will be modified however the original
variable will remain same and it will not change.
Example
Main()
Area(L,W)
Area = L *W
Print(“The area is”Area)
Return Area
def House(Area,Price)
House =Area * Price
Print(House)
PASS BY REFERENCE
•Pass by reference is where a function receives a direct reference to the original variable's
memory location, allowing it to modify the variable directly. This means any changes made to
the variable within the function will affect the original variable outside the function.
Example
Area (List A) return
List [2] + 2
Main()
List = [ 5, 6, 7, 8]
Area (List)
Output Area
Output List