circle
Wed Jun 19 2024 09:36:01 GMT+0000 (Coordinated Universal Time)
Saved by
@pvignesh
import turtle
class Circle:
def __init__(self, x, y, radius):
self.x = x
self.y = y
self.radius = radius
def __str__(self):
return "Circle at ({self.x}, {self.y}) with radius {self.radius}"
def draw_circles(circles):
t = turtle.Turtle()
for circle in circles:
t.goto(circle.x, circle.y)
t.circle(circle.radius)
# Create some Circle objects
c1 = Circle(0, 0, 75)
c2 = Circle(10, 10, 100)
c3 = Circle(50,50,200)
# Draw the circles on a canvas
draw_circles([c1, c2, c3])
content_copyCOPY
Comments