Lab 4.03 - Nested For Loops
In this lab we will be drawing images using nested for loops.
For each of the following problems, you will write a function that will draw the desired output. You may use an extra function if you find it helpful.
Write a function,
draw_7
, to draw the 7x7 square (shown below)* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Write a function
stars_and_stripes
, that will draw a 3 sets of rows. 1st a row of 7 stars followed by a row of 7 dashes (shown below)* * * * * * * - - - - - - - * * * * * * * - - - - - - - * * * * * * * - - - - - - -
Write a function,
increasing_triangle
that will print out following:1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 6 7
Write a function,
vertical_stars_and_stripes
that will print out the following:- * - * - * - - * - * - * - - * - * - * - - * - * - * - - * - * - * - - * - * - * - - * - * - * -
Bonus!
Write a function that will print a border around a 7x7 square (shown below)
* * * * * * * * * - - - - - - * * - - - - - - * * - - - - - - * * - - - - - - * * - - - - - - * * - - - - - - * * - - - - - - * * * * * * * * *
Write a function that will print the following
balanced_triangle
.1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6 1 2 3 4 5 6 7 1 2 3 4 5 6 1 2 3 4 5 1 2 3 4 1 2 3 1 2 1
Write a function that will print the following triangle.
* *** ******