Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import Turtle
- tina = Turtle()
- # we originally had a line tina.dot(100) which resulted in the program drawing
- # a black circle with a diameter of 100.
- # This has been deleted now that the following code has been added.
- # The new code is to have us make the radius: as a function with the radius as
- # a parameter of the function.
- def draw_circle(Tina,r,red):
- tina.color(red)
- tina.dot(r*2)
- draw_circle(tina,25,"red")
- # then we can add colour (american spelling, so color) by including it in
- # the definition of draw_circle, so
- # so we will go back and add color as a parameter inside the draw_circle()
- # below the def line we add tina.color(colorchoice)
- # finally we give our instr5uvction (see line 14) to which we have added "red"
- # IT WORKS
- # AND NOW to create coloured circles, code would look like
- draw_circle(tina,100,"blue")
- draw_circle(tina,60,"white")
- draw_circle(tina,20,"red")
- # THAT WORKS TOO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement