Mindmajix

Functions of multiple arguments

Every function in Python receives a predefined number of arguments. It is possible to declare functions which receive a variable number of arguments. In high level programming, it is often required to define functions that can take more than one argument.

The format of the multiple arguments function is as follows:

def function_name(first_arg,second_arg,third_arg):
#use all the arguments to accomplish the task

If you have understood the basics of function, then functions with multiple arguments should not be a problem for you. The following is an example of a function with multiple arguments.

Screenshot_35

How to use variable length argument lists in Python.

The special syntax, *args and **kwargs in function definitions is used to pass a variable number of arguments to a function. The single asterisk form (*args) is used to pass a non-keyworded, variable-length argument list, and the double asterisk form is used to pass a keyworded, variable-length argument list.

https://docs.python.org/3.3/library/argparse.html

Enroll for Instructor Led Live Python Training

0 Responses on Functions of multiple arguments"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.
Course Adviser

Fill your details, course adviser will reach you.