Sorry for the beginner question -- In running this code, it prints the output twice rather than printing once and then continuing on to the next iteration of the loop. I'm sure this is simply a formatting error, but I can't seem to spot it... Thanks!
myList = [1, 1, 1, 0.5, 1, 1, 2, 1, 0.5, 1, 3]
for thisThing in myList:
baseIndex = myList.index(thisThing)
if thisThing == 0.5:
get_previous = myList[baseIndex - 1]
get_next = myList[baseIndex + 1]
T2 = thisThing * 2
if T2 == get_previous and T2 == get_next:
print("Success at index " + str(myList.index(thisThing)))
continue
OUTPUT:
Success at index 3
Success at index 3