Arguments
- Information can be passed into functions as "Arguments".
- Arguments are specified after the function name ,inside the parenthesis().
Arguments are classified into two types:
- Actual argument
- Formal arguments
- Arguments are simply a variable or value inside the parenthesis.
- More than one argument can be specified inside the parenthesis by separating it with comma.
Actual Arguments
Arguments specified inside the parenthesis in the function call are
called actual arguments.
Syntax:
Function_name(actual arguments)
Formal Arguments
Arguments specified inside the parenthesis in the function header are
called formal arguments.
Syntax:
def function_name(formal arguments)
Program:
def personalinfo(name,age,hobby): #formal arguments
print("name:",name)
print("age:",age)
print("hobby:",hobby)
personalinfo('sam',53,'tenis')
#actual arguments
Output:
name: sam
age: 53
hobby: tennis
More topic in Python