# Changing Turtle Programs¶

Run the following program.

csp-5-6-1: If you wanted to make both of the turtle lines in that last program the same length, what change would you make to the program? (Feel free to actually make the change in the program and click Run to try it!)

• Change the 150 to 90
• The turtle moves forward 150 units and turns 90 degrees.
• Change the 75 to 90
• The turtle moves forward 75 units and turns 90 degrees.
• Change the 75 to 150
• Then both sides would be 150 units long.

Slightly Harder Problem: Now, let’s connect the end point to the starting point. The shape we’ll create is a right triangle (a triangle that has a 90 degree interior angle). The number 57 isn’t guesswork – it is roughly the square root of 40^2 + 40^2. However, there is an error in this program and it won’t work as intended. Can you fix it?

csp-5-6-2: The code `alex.left(0)` will not turn the turtle toward the starting point. Which of these will?

• alex.left(45)
• The turtle turns the exterior angle, not the interior angle.
• alex.left(90)
• That would make another right angle. Which would be more like a square shape.
• alex.left(135)
• The interior angles of a triangle need to add up to 180. So far we have one angle of 90 so the other two must be equal and must total 90. They both have to be 45, but we tell the turtle to turn the exterior angle so 180 - 45 = 135.

Note

Discuss topics in this section with classmates.