import turtle import random
def drawCircle(myTurtle, x,y, radius, color):
- myTurtle.penup() myTurtle.goto(x,y) myTurtle.pendown() myTurtle.begin_fill() myTurtle.color(color) myTurtle.circle(radius) myTurtle.end_fill()
colors = ['red','yellow', 'blue', 'green', 'black', 'gray', 'pink']
radii = [10,20,30,40,50,60]
numCircles = int(input('Enter number of circles:'))
width = 500 height = 500 width2 = width//2 height2 = height//2
screen = turtle.Screen() screen.setup(width,height)
myTurtle = turtle.Turtle() myTurtle.speed(0)
for i in range(numCircles):
- x = random.randint(-width2,width2) y = random.randint(-height2,height2) radius = radii[random.randrange(0,len(radii))] color = colors[random.randrange(0,len(colors))] drawCircle(myTurtle,x,y,radius,color)
screen.exitonclick()