3.5.5 Hexagon Codehs !link! ✦ Top-Rated

A student could technically write:

| Concept | Value | |---------|-------| | Number of sides | 6 | | Loop repeats | 6 times | | Side length | Any positive number (we used 50 or 75) | | Turn angle | 60 degrees (right turn) | | Interior angle | 120° (but you never use it directly) | 3.5.5 hexagon codehs

To complete the exercise in CodeHS, you need to use a for loop to draw a six-sided shape. Since a hexagon has internal angles that sum to 720°, each exterior turn for the Tracy turtle must be 60 degrees . Here is the code "piece" you need: for i in range(6): forward(50) left(60) Use code with caution. Copied to clipboard Why this works: A student could technically write: | Concept |

If you’re working through the or Graphics unit, you’ve probably hit 3.5.5: Hexagon . At first glance, it seems simple: just draw a six-sided polygon. But getting the angles right and placing it correctly on the screen can be tricky. Copied to clipboard Why this works: If you’re

t.fillPolygon(vertices); // requires storing points

The turtle draws a shape that looks like a star or a spiral, never closing the polygon. The Cause: The turn angle is incorrect. If a student uses turnRight(120) (the interior angle) instead of 60 (the exterior angle), the turtle will turn too sharply. The Fix: Remember the rule: $360 / \textnumber of sides$. For a hexagon, the turn must be 60 .

Nothing appears on the screen, but the program runs successfully. The Cause: The pen is up. The Fix: Ensure penDown() is called before the loop begins. (Note: In many default CodeHS exercises, the pen starts down, but if you have used penUp() previously in the program, you must reset it).