Back

Drawing shapes using functions and the turtle module - practical work 3

Q1. Get this code working. What does it do?:

import turtle
import math
import random

from turtle import *

def n_eck(n, size):
     for i in range(n):
          rt(360./n)
          fd(size)

def mn_eck(n, size):
     for i in range(n):
          rt(360./n)
          n_eck(n, size)

turtle.speed("fast")
turtle.bgcolor("black")
turtle.pencolor("red")
turtle.pensize(3)
mn_eck(36, 20)

Q2. Change the colours, the values and so on to see what happens.
Q3. Speed up drawing (refer to the turtle documentation).
Q4. Try altering the pensize.
Q5. Try adding your own instructions.

Back