• Homework
  • Thirds
  • Upper Thirds
  • Fourth
  • Divisions
    • ICT
    • Computer Science
  • Fifth
  • Lower Sixth
  • Upper Sixth
    • Upper Sixth Theory
  • Blog
  • Careers
  • Unity
  • Networking

More turtle challenges

Random Polygons

Take the random square example from this page and change it so that it draws polygons of a random side number (between 3 and 12)

Picture

Picture
Temple of Doom

Using turtle.goto(), turtle.penup() and turtle.pendown() - together with a function to draw a shape, can you draw a whole series of shapes one inside the other.

MultiStar

Here the challenge is to create a function with a parameter that tells the function whether or not to fill in the star.  You can then draw outlined figures by calling the function twice - the first time filled in, the second as just an outline.
Picture

Picture
Versatile Square

This square function is centred on the current turtle position.

We save the current turtle position before we start drawing
def square(size):
    oldx = turtle.xcor()
    oldy = turtle.ycor()
Then lift the pen up, move half of the size value across, turn right and move half of the size value down.  That should put us at a corner.  Turn right again and draw the square normally.  When it's done, return to the home position using
   turtle.goto(oldx,oldy)

Now add some user interaction to your program with EasyGUI - Click here

Powered by Create your own unique website with customizable templates.