Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


To design the cross (shapeA), I followed the same general pattern of the square-making code, except that instead of turning left all the time, the turning pattern would be left-left-right, which makes the turtle constantly draw three sides of a square, but never fully close it, instead linking it together with others of its kind. Designing the "L" shape(shapeB) was similar, except that I closed off the shape instead of continuing with the left-left-right pattern and I had different "forward" values, which means the sides had different lengths.  For task 5, I combined shapeA (cross) and shapeB (L) into one shape called "ShapeC". I first defined the shapes using the "def" function, e.g. "def shapeA():" and then started typing in the instructions for the turtle below, but indented them one level. By doing this, and using the "def" function, I prevented shapeA from being drawn unless it was told to. I did the same for shapes B and C(which was a call to draw shapeA, move forward 100 pixels, then draw shapeB), then at the end, I called shape C by simply typing in "shapeC". For the last task, I added in a "shapeD" to the previous file, and used a "shapeE" function to call it. Shape D had a variable called "distance" in the parentheses, so I left the "forward" functions defined not by a number, but by "distance". Shape E was used afterward to plug in four different values for the "distance" variable: 100, 80, 60, and 40. 

For this project, I did extensions 1 and 3. For extension 1, I defined shapes A, B, and C, and made a function called "callall" at the end that called A, B, and C and drew them all together, then called that function. For extension 3, I made a set of instructions that calls a square, then made it repeat twice by starting with "for i in range (2):", which makes a square twice (the number in the parenthesis is the number of times the instructions are followed.

In this project, I learned how to use the python turtle commands, like "forward", "left", and "up". I also learned how to use indentation in Python to change what I want the code to do, and also how to repeat a set of instructions multiple times. Image Added Image Added Image Added