saving . . . saved default parameters has been deleted. default parameters has been hidden .
default parameters
Title
Question
What is the exact use of functions with default parameters in python?

Python-3.4.3 Advanced-Features-of-Functions 03-04 min 10-20 sec 22-06-19, 11:36 a.m. balajeemaram

Answers:

When a function is defined with default parameters like so

def myfunc(arg1, arg2=99, arg3='mystr'):
...

You can call the function such that you may or may not have to specify the arg2 and arg3 values

Hence all these are legal function calls for the above definition:

myfunc(22, 99, "new-string")

myfunc(22, 99)

myfunc(22)
22-06-19, 11:44 a.m. ankitrj.iitb


Log-in to answer to this question.