How can I fix this code to make the turtle a random color? I want to be able to click to make the turtle turn and change color.
import turtle
import random
turtle.colormode(255)
R = 0
G = 0
B = 0
def color(x, y):
turtle.color((R, G, B))
def turn(x, y):
turtle.left(10)
for i in range(10000):
turtle.onscreenclick(turn)
turtle.forward(1)
turtle.onrelease(color)
R = random.randrange(0, 257, 10)
B = random.randrange(0, 257, 10)
G = random.randrange(0, 257, 10)
def color(x, y):
turtle.color((R, G, B))