I have a function which returns 4 lists.
def foo ( Input1, input 2)
return list1, list2, list3, list 4
I am using following code right now:
x0, y0, z0, w0 = foo(ip0, ip4)
x1, y1, z1, w1 = foo(ip3, ip1)
x2, y2, z2, w2 = foo(ip3, ip4)
x3, y3, z3, w3 = foo(ip1, ip2)
I want to reduce the number of lines and may be use a for
loop.
I tried while loop:
i=0
while i<3:
'x'+str(i), 'y'+str(i),'z'+str(i),'w'+str(i)= foo(input[i], input[i])
i +=1
Python is throwing an error, it thinks I am assigning a value to a string. How do I unpack the tuple and generate variable name using a loop or automatically?