Is there a way to set a default parameter value in a function to be another one of the parameters?
I.e.
def (input1, input2 = input1)
I figure I can do something like what’s shown below, but want to know if there’s a better way
def (input1, input2 = 'blank')
      If input2 == 'blank':
           input2 = input1
                You could try this. Maybe a little more clarification could help us help you more.
def do_stuff(input1, input2 = None):
    if input2 is None:
       input2 = input1
You were pretty close.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With