Codecademy Forums

Thread Shed Challenge

Consider the scope in which a given variable is to exist. One inside the loop, one outside.

Okay, from what you are saying, does that mean that i need to move the line

transactions_clean.append(transaction_clean)

outside of the loop?

There are two loops, one nested in the other, are there not? One of the arrays gets appended in the nested loop, the other in the outer loop. You have the right idea, though. Just make sure they’re not both being appended inside the same loop body.

loop
    loop
        tran_clean.append(transaction)
    end
    trans_clean.append(tran_clean)
end

That is pseudo code, not Python.

Hi noispaxen.

I hope you can help me a little bit.

‘thread_sold_split =
for i in thread_sold:
if i.find("&") == -1:
thread_sold_split.append(i)
else:
b = i.split("&")
for c in b:
thread_sold_split.append©’

In this code that you wrote, can you explain me the “-1” after che t i.find("&")? Why have you put that one? In that case i prefered to write this, although, I believe that It is not right.

‘thread_sold_split =
for x in thread_sold:
for i in x:
if “&” not in i:
thread_sold_split.append(i)
elif “&” in i:
thread_sold_split.append(i.split("&"))
print(thread_sold)’

Thank you for you time!

hey guys, I coded a correct code that get the job done perfectly, I uploaded it at GitHub, who ever have an update or another way to code the solution for the given problem is welcome at GitHub