How to check for all characters in a string and then set graphics to certain color?
<p>If there is a "_" in the string then set graphics to the gray color.
If there is a "X" in the string then set graphics to the red color.
If there is a "Y" in the string then set graphics to the blue color
User inputed the strings below.
trying to check all the characters individually then color graphics.
lines_counter is the amount of user inputed lines, which is four.</p>

<pre><code>string = ["Xx_x"],[YxXy],[X__y],[xy_y]

for j in range(lines_counter):
new_string = "" 

    for i in range(len(string)):
        if i == 0:
            if string[i] == "_":
                draw_cells.setFill('gray')
            if string[i] == "X":
                draw_cells.setFill('red')
            if string[i] == "Y":
                draw_cells.setFill('blue')
        elif i == len(string) - 1:
            if string[i] == "_":
                draw_cells.setFill('gray')
            if string[i] == "X":
                draw_cells.setFill('red')
            if string[i] == "Y":
                draw_cells.setFill('blue')
</code></pre>
