teromakotero icon

Draw circle

teromakotero | PRO | 05/05/19 10:37:08 AM UTC | 0 ⭐ | 333 👁️ | Never ⏰ | []
Python |

700 B

|

None

|

0 👍

/

0 👎

'''
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)

Comments