Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- At the moment all our circles are drawn at the centre of the screen.
- Can you add parameters to the draw_circle function so that you can draw circles at different locations
- on the screen?
- The goto(x, y) function moves the turtle to a specific location.
- The penup() function lifts the pen so that the turtle doesn’t draw when it’s moving.
- What do you think is the best order for the input parameters for your function?
- '''
- from turtle import Turtle
- drawer = Turtle()
- def draw_circle(turtle_name, r, color, x, y):
- turtle_name.color(color)
- turtle_name.penup()
- turtle_name.goto(x,y)
- turtle_name.pendown()
- turtle_name.dot(r*2)
- draw_circle(drawer, 10, "red", 100, 100)
Advertisement
Add Comment
Please, Sign In to add comment