This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 3: While loops

Wider triangle of stars

face Josiah Wang

Now, update your previous code so that each row now prints two columns of stars more than the previous row.

For example, the following output is expected for rows = 5.

Enter an integer: 5
*
***
*****
*******
*********

And here is the expected output for rows = 6.

Enter an integer: 6
*
***
*****
*******
*********
***********

Hint: Don’t jump straight into coding! Figure out the mathematical pattern between the row and the number of columns first before actually doing any coding!