I've searched for a relevant thread on how to do this but I cannot find anything.
I have an array:
x = [a,a,a,b,a,a]
I want to copy the elements of the array into a new array until I find 'b'. I tried to do this with a loop but I get an error that "y is not defined", I tried initializing y but that didn't work either. Any ideas? I'm sure there is a better way to do this.
for ii in x:
if x[ii].find(num) == 0:
break
else:
y[ii] = x[ii]
x[ii].find(num)? You have a list of integers or strings?