When we call a function in a programming language, we often need to pass data (or parameters) to that function for it to operate on. The way these parameters are passed — either by value or by reference — plays a critical role in how a function interacts with the data. This distinction influences whether changes made to the parameters within the function affect the original data outside the function.
Passing parameters by value or reference determines whether a function receives a copy of a variable (value) or a reference to the original variable (reference).
Passing Parameters by Value
When parameters are passed by value, a copy of the data is passed to the function. This means that the function works with a separate copy, and any changes made to the parameter inside the function do not affect the original data outside the function. This approach provides a level of safety, ensuring that the function’s operations on the parameter do not have unintended side effects on the original data.
Did you know? In Python, immutable data types such as integers, strings, and tuples are always passed by value.
def modify_value(x):
    x = x + 5
    print("Inside function:", x)
a = 10
modify_value(a)
print("Outside function:", a)
With this example the output would be:
Inside Function: 15
Outside Function: 10
Explanation:
We define a function, modify_value, which adds 5 to its parameter x.
We call the function with a, an integer set to 10.
Inside the function, x becomes 15, but a outside the function remains unchanged at 10.
Since integers are immutable, Python effectively passes them by value. The function receives a copy of a, not the original a, so any changes within the function do not reflect outside it.
Passing Parameters by Reference
When parameters are passed by reference, the function receives a reference to the original data, not a copy. Therefore, any modifications to the parameter inside the function will directly affect the original data outside the function. This approach can make code more efficient, as it avoids copying large amounts of data, but it requires careful handling to avoid unintended side effects.
In Python, mutable types such as lists and dictionaries are passed by reference.
def modify_list(list):
    list.append(5)
    print("Inside function:", list)
my_list = [1, 2, 3, 4]
modify_list(my_list)
print("Outside function:", my_list)
With this example the output would be:
Inside Function: [1, 2, 3, 4, 5]
Outside Function: [1, 2, 3, 4, 5]
Explanation: 
The function modify_list adds the value 5 to the list parameter list.
We pass my_list, which is [1, 2, 3, 4], to the function.
After the function executes, my_list outside the function has been modified to [1, 2, 3, 4, 5].
Since lists are mutable, Python passes my_list by reference, meaning the function operates on the original list. Any modifications to list within the function also apply to my_list.
Note that an alternative approach to using parameters for a subroutine to access a variable defined outside the subroutine is to use a global variable though this is often a less desirable option.
							
MS-DOS (Microsoft Disk Operating System) is an early operating system developed by Microsoft in the early 1980s. It was widely used on IBM-compatible personal computers and is known for its command-line interface, where users type commands to perform tasks rather than using a graphical interface. MS-DOS was foundational in the development of later Windows systems and provided basic functions for file management, program execution, and device control.


							



							


							
							


							



							
For this quiz we will use a data set of 10 of the most iconic mountains in the world. 
							
							
You’ve probably seen CDs, DVDs, or Blu-rays, especially for music, movies, or games. These round discs are examples of optical storage. This technology uses light to read and write data. Here’s how it works:
If you’ve ever heard of hard drives (HDDs) or magnetic tapes, these use magnetic storage technology. This is one of the oldest storage methods and works by storing data as magnetic patterns on a spinning disk or a tape.
Solid-state storage is the most modern and fastest-growing storage technology, used in solid-state drives (SSDs), SD cards and flash drives (USB sticks). It is different from magnetic or optical storage because it has no moving parts—everything is done electronically.

