Homework #4:
-
Two files were created: follow.py and linearC.py. follow.py is designed to execute
commands in turtle and draw pictures from variables entered by the operator. linearC.py
does essentially the same thing, but reads a string of variables from another file. Each
variable was assigned a function from a different file or a turtle command like forward(10).
-
follow.py asks the user for raw input. The user enters variables. The function processString
executes the functions defined for each variable. A loop of the processString function ensures that
as long as the user continues to enter data, turtle will continue to execute his commands.
linearC.py does essentially the same thing, but asks the user to enter the name of a file.
The program opens the file, reads the first line of this file, and uses processString to execute the
string of variables to create a picture in turtle.
-
-
-
-
I completed the extra steps for the extension. The picture above shows a snowflake that koch.py draws.
koch.py writes a complex string and creates a new file in the directory. linearC.py can be used to open
the file and execute the commands in turtle. When the number of iterations (complexity) increased and the
forward command remained the same, the size of the snowflake got bigger.