Hi all,
I need some help understanding the efficiency of my code. I am new to python(and coding in general) :(
if i have a code like this
Is there a more efficient way to code this. (my code goes through a list and if something matches it appends values to other lists)
Also
the second code compares 2 lists and creates a 3rd list based on the results.
I am guessing this code is especially poor.
your help is greatly appreciated.
thanks for your time!
I need some help understanding the efficiency of my code. I am new to python(and coding in general) :(
if i have a code like this
Code:
L2 = [] L3 = [] i = 0 while i < len(L0): if L1[i] == X: L2.append(Y) L3.append(Z) else: L2.append(0) L3.append(0) i = i + 1
Also
Code:
L2 = [] i = 0 while i < len(L0): j = 0 while j < len(L1): if L0[i] == L1[k]: L2.append(X) break else: L2.append(0) j = j + 1 i = i + 1
I am guessing this code is especially poor.
your help is greatly appreciated.
thanks for your time!
Comment