So I've got multiple lists like:
transaction = ['BUY', 'SELL', ...]
company = ['Acer', 'Cemex', ...]
value = [[0.5344, 2.23423], [5.43534, 4.3342543], ...]
The pseudo code that I want is like:
for iteration in transaction:
count = 0
if iteration == 'BUY':
for each different company in the list company:
execute an equation to add to an accumulator
count += 1
if iteration == 'SELL':
for each different company in the list company:
execute an equation to subtract from an accumulator
count += 1
Can anybody explain to me what method I would use to achieve the outcome that I would like. I was thinking a for loop with multiple if statements beneath it, but it doesn't work.
for each in company:instead offor each different company in the list company:), and all you have left to implement is the equation.forloop and placing bothifs in there as anif/elifblock.company[0]has to correspond withtransaction[0]and so on. I've updated my pseudo code. Can you tell me if my logic is on the right track? Thanks.zipfunction if you want to loop throughcompanyandtransactionat the same time iefor x,y in zip(company,transaction):zipwouldn't be appropriate. Of course, the code may be doing something other than intended...