How to create an optional positional argument in python
How would I create an optional positional argument in python? All the instructions I've been able to find are unclear.
Answered by InvisibleOne (2672) [earned 5 cycles]
something like this:
def banana(name, color='yellow'): # color will default to yellow if not argument is given print("Nice " + name + " banana that is " + color) banana("joey") # will print out the color as yellow banana("bill", "green") # will print out the color as green