![Technovation logo](../_images/Technovation-yellow-gradient-background.png)
2.5. Practice Makes Perfect¶
Let’s take another look at drawing a square. How could we re-write it using a loop?
![Image of dashed line drawn with Python Turtle](../_images/dashed-line.png)
Let’s use what we know about loops to draw a dashed line across the entire box!
The code below draws two dashes. See if you can modify it to use a loop!
![Image of a triangle drawn with Python Turtle](../_images/triangle.png)
![Image of a pentagon drawn with Python Turtle](../_images/pentagon.png)
![Image of a hexagon drawn with Python Turtle](../_images/hexagon.png)
Why stop with squares? Shapes with any number of sides can be drawn using a loop!
Start with your code that draws a square. Then, change the number of times the loop
repeats and the angle that you turn each time to see if you can draw these shapes.
![Image of a row of cirlces drawn with Python Turtle](../_images/circle-row.png)
Try converting you dashed line into a row of circles! Let’s draw 20 circles, each with a radius of 10.
![Image of a row of squares drawn with Python Turtle](../_images/square-row.png)
Try drawing a row of squares!
For this problem, try using two loops! One to draw each square (same as in the first problem on this page), and another to draw the square multiple times
![Image of a plus sign drawn with Python Turtle](../_images/plus.png)
Try drawing a plus sign using a loop!
If you’re not sure how to do it with a loop, try writing it out line by line first.
Once you’ve got it drawing a plus sign, see if you can put any repeated code in a loop!
![Image of an asterisk drawn with Python Turtle](../_images/asterisk.png)
Now try modifying your code from the plus sign into an asterisk!
Hint: you’ll need to change the number of repetitions and the angle that you’re turning each time
You have attempted of activities on this page