Parameters allow functions to share data.
We can define and function to process parameters eg:
#this function adds two numbers and displays the result
def addTwo(num1, num2):
print(f"{num1} + {num2} = {num1 + num2}")
Then, when needed, we can call the function:
def main():
addTwo(7,2)
addTwo(0,-2)
addTwo(13,4)
#call main
main()
Parameters allow functions to share data. They do this by using parameters.
When Function A passes data to Function B, Function B uses its parameters to grab the data and then it can process the data!
This strategy reduces the need for global variables.
module function return identifier parameter pseudocode return typedefinecalldata type