I am learning Python.
I learned about default value and arbitrary arguments.
So, I made my function which has a parameter offering a default value, and another parameter having an arbitrary number of arguments.
def make_pizza(size=15,*toppings):
"""Summerize the pizza that we are about to make."""
print("\nMaking a " + str(size) +
"-inch pizza with the following toppings: ")
for topping in toppings:
print("- " + topping)
make_pizza('onion','shrimp','goda cheese','mushroom' )
make_pizza(17,'ham','extra meat','sweet con','pepperoni')
At the first function call, I wanted to use the default value for the "size" parameter which is "15" and the "*toppings" arbitrary argument.
But, I couldn't figure out how to do this.
Could anyone tell me when I call a function with multiple arguments, how I can use parameters' default values and arbitrary arguments at one function call?
Sorry in advance if you feel uncomfortable with my English(I am not a native.)