I’m looking for an answer to this problem:
I’m running through a loop testing for a condition every time (if data[i] is red), and when a value of the array is red i print something but if the next value (data[i+1]) isn’t red, i want to print something else to the rest of the line without testing if any next point is red or not. So my code was looking a little bit like this.
For i in range (0, 64) :
If data[i] = red :
Print '#'
If data[i+1] != red :
#here i want to print '.' for the rest of the line without testing anything and getting out of the loop
Else :
print '#'
Else :
print '.'
And i don’t know what to put to make this code work.
For example if in my array there is :
data[i] = red, data[i+1] = blank, data[i+2] = red. I want to remove second red. I want to print the rest of the array blank, without testing if it’s red after a blank space.
I’m gonna use the algorithm in image processing. I’ve got two balls, one on the left and one on the right. This algorithm is gonna remove the one on the right entirely.
Print
'#'ifredelse print'.'. If encounted sequencered, notredthen print'.'for the rest of the array:Example