how to provide default value for paprametersin python code example

Example: how to provide default value for paprametersin python

# Default Parameter Value
# The following example shows how to use a default parameter value.

# If we call the function without argument, it uses the default value:

######################## EXAMPLE ########################################

def function(parameter = "default value"):
  print("some group of words " + parameter)

function("string")
function("someother string")
function()

####################### OUTPUT ##########################################

some group of words string
some group of words some other string
some group of words default value

Tags:

Misc Example