Register to receive free access to all teacher materials.
Exponents and Loops
Explore exponents using loops.
Free Teacher Materials
The code below shows a nested loop, which is one loop inside another loop. The inner loop draws a triangle by moving the Finch 20 cm and turning 120° three times.
Before running the program, sketch the path you think the Finch will take. How many triangles will the Finch draw? How many line segments will the Finch draw? Express your answers with exponents. After you make your hypotheses, try out the program.
Next, consider the program shown below. How many triangles will the Finch draw? How many line segments will the Finch draw? Express your answers with exponents.
How would you create a program that draws 2,187 line segments (you probably don’t want to actually run this one)?
Finally, use nested loops to write a program that draws 25 pentagons. How many line segments is that?