I am trying to do an operation like the one below:
a = 2
b = 4
c = 6
def my_function(a,b,c):
a1 = a*2
b1 = b*2
c1 = c*2
return (a1,b1,c1)
x = my_function(a,b,c)
my_function(x)
Where I would like to call my_function()
iteratively on its own output if it meets a certain condition.
However, I get the result:
TypeError: my_function() missing 2 required positional arguments: 'b' and 'c'
I am sure this is a basic question and has been answered elsewhere, but it seems so simple that it is difficult to search for.
use *
to Unpack tuple so that all elements of it can be passed as different parameters.
my_function(*x)
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