I have two sub functions that feed into one main functions as defined below –
Sub function 1
def func(x=1,y=2):
z = x + y
return z
Sub function 2
def func2(a=3,b=4):
c = a-b
return c
Main function
def finalFunc(lemons, input1,input2,input3,input4):
result = func(input1,input2) + func2(input3,input4) + lemons
return result
How do i call my main function but if the values for the sub functions aren’t specified, they’re treated as default. Similarly if they are specified, then use them instead? e.g
>>> finalFunc(lemons = 1)
5
or
>>> finalFunc(lemons = 1, input1=4, input4=6)
6
edit – I should add, i dont want to specify the default values in my main function as the sub functions are always changing. I want to keep the default values set at whatever the sub functions contain.
You need to sign in to view this answers