# 3. Iteration Challenges

Each of these can be done in 4 lines of code, and one is `import turtle`.

Do these challenges in the Python IDLE editor. You will first have to do sheet Writing your own programs using IDLE

## 3.1. Polygons

In only 4 lines of code (each). Only the 1st need be 4 lines, the others can be 3 lines, as you only have to do `import turtle` once.

> If for each shape we end up where we start, and facing the same way. Then how many times do we turn? What is that in degrees?

> So for a square we do that in 4 chunks. That is `360/4`. What would it be for a triangle, for a hexagon …

- Draw a square (task1)
- Draw a triangle (task2)
- Draw a hexagon (task3)
- Draw a 20-gon (In geometry, an icosagon or 20-gon is a twenty-sided polygon) (task4)

Remember only 3 lines of code each + `import turtle`

## 3.2. Other shapes (Task 5)

> What would happen if instead of turning 360°, we turned 2×360°? (in python that is `2*360`).

Try some shapes with 5,7,8,9 … sides where the turtle turns 2×360°, or 3×360° or …

How do you need to change `360/n` where `n` is the number of sides.

## 3.3. Spiral (Task 6)

(iteration)

How can you use this code to draw? `turtle.forward(2*i)`

## 3.4. Multiple (Task 7)

Next Section - 4. Procedures