There is two things to keep in mind.
The variables that we define outside of a function are called to be in global scope.
They're called global variables.
The variables that we define inside the function used to be in local scope.
They're called local variables.
Note: Function can also use global variable or even you can define global variables inside the function.
lets understand it..
return 2 * x
return 2 * y
return 2 * z
I defined 3 functions and just changed the parameter's name.
Do you think they will work differently?
Key thing to understand that the parameter you pass are in local scope.
They are just names,like variables. You can name it anything you like.(Make sure that they have valid variable's name). here in my example it represents any general number.
When you pass some value..
The parameter is just replaced by this value. (x --- > 4 )
One more thing.
These parameters or variables that're defined inside the function have existence till they're called and executed,after execution halts they have no meaning.
In your above code,the
numbers parameter actually represents any list with numbers as item.
so if you pass n,it will work on it.
even you make your own list..
m = [23,4,5,6,7,8]
and pass it to your above code by calling the function,It will work.