Let's say I have 3 variables & a function func
:
a=1;b=1;c=1
def func(a=a,b=b,c=b/a):
print(a,b,c)
To my surprise, func(b=2)
produces an output:
1 2 1.0
Why is c
not b/a
, ie not 2/1=2
?
How can I make the function recalculate the c
when called, if either non-default a
or b
(ie either of them doesn't equal 1
) is passed?