how to provide default value for paprametersin python

Solutions on MaxInterview for how to provide default value for paprametersin python by the best coders in the world

showing results for - "how to provide default value for paprametersin python"
Ella
30 Jul 2017
1# Default Parameter Value
2# The following example shows how to use a default parameter value.
3
4# If we call the function without argument, it uses the default value:
5
6######################## EXAMPLE ########################################
7
8def function(parameter = "default value"):
9  print("some group of words " + parameter)
10
11function("string")
12function("someother string")
13function()
14
15####################### OUTPUT ##########################################
16
17some group of words string
18some group of words some other string
19some group of words default value