I'm prety new to python so my question might be basic but is there a way to change two variables at the same time when using a function. my problem is i currently use a double for loop to do so and it creates a lot of useless values. As we understand better by exemple, here is a rapidly crafted one:
results=[]
Q1=[1,2,3]
P1=[4,5,6]
def findcash(Q,P):
r=Q/P
results.append(r)
for i in Q1:
for j in P1:
findcash(i,j)
now you see my return vector will have values of 1/4 ;1/5; 1/6 ... where in reality i would like Q1 to change when P1changes so results=[1/4 2/5 3/6]
Cheers
globalthere.zipthe lists