6. Parameters and Arguments
Parameters and arguments are used to pass values to a function.
- Parameters: Variables mentioned inside the function definition.
- Arguments: Actual values passed during the function call. Example:
def add(no1, no2):
print(no1 + no2)
add(100, 200)
Output:
300
Explanation:
- no1 and no2 are parameters.
- 100 and 200 are arguments.
Function with Three Parameters
def add(no1, no2, no3):
print(no1 + no2 + no3)
add(5, 10, 15)
Output:
30
Top comments (0)