I was given the following feedback:
functions are not defined for stepwise refinement, and functions are not defined and are called instead of repetitive code.
I am not sure exactly what is meant by that...
## Importing turtle to 'draw' the fractal images ##
from turtle import *
def draw_fractal(initial_state, target, replacement, num_replacements, \
length, angle):
## Set result (also known as initial output ) to the inital state##
result = initial_state
## Incorporating the number of replacements into the formula as to ensure
## that each fractal image will replace as many times as the test
## run states ##
for i in range(num_replacements):
## Replacing the 'target' with the replacement' and also stating the
## replacements for Island Lakes Question ##
result = result.replace(target, replacement).replace('f', 'ffff')
## Set the speed of turtle to be the fastest and eliminate the tracer ##
speed('fastest')
tracer(0)
for command in result:
if command == target:
## Turtle moves forward by the length given to us in the test runs ##
forward(length)
elif command == '+':
## Turtle turns right at the angle given to us in the test runs ##
right(angle)
elif command == '-':
## Turtle turns left at the angle given to us in the test runs ##
left(angle)
elif command == 'f':
## Pulls the pen up, turtle moves forward by the length given to us in
## the test runs and the pen is put back down ##
up()
forward(length)
down()