External Exam Download Resources Web Applications Games Recycle Bin

Spiral

spiral.py

import turtle
from random import randint
t = turtle.Turtle()
t.colormode(255)
t.speed(50)
x = 1
while x < 400:
    r = randint(0,255) #makes variables r,g,b whose value is an integer,
    g = randint(0,255) # which is between 0 and 255. It is random, and
    b = randint(0,255) # changes every time the loop runs
    t.pencolor(r,g,b)
    t.forward(50 + x)
    t.right(90.911)
    x = x+1