Let me start off by saying I'm glad you've made it this far. Hang in there. This looping assignment is not trivial.

Let me also say that there is always more than one solution to every programming problem. You could have used a different approach (maybe like the columns and rows thing you bring up) and get the task done.

My first suggestion is to forget the code you've seen (but not the concepts) and go back and try to write the code for the first two examples from scratch. If you can pull off those two, then making the leap to the last one (by far the hardest of the three) is quite a bit easier to do.

Seriously. Go try it. (Maybe you already have.) Then give the last one another shot.

Also, if you're able to get the first two problems on your own, but the last one is causing you a ton of trouble, don't worry about it. Give it a shot, and then move on. If you can do the first two, you have nothing to worry about.

Let me also try to explain the code I've written in more "normal" terms.

Let's look at it this way. I have a total of six lines. So I know I'm going to have a loop (the outer loop) that goes from 1 to6 (or rather, 0 to 5, because programmers love starting at 0 instead of 1).

On each line, I'm going to print out a certain number of spaces, followed by a certain number of stars. That's what my two inner loops are for. The trick is figuring out *how many*.

Let's do this:

Line |
Spaces |
Stars |

0 |
5 |
1 |

1 |
4 |
3 |

2 |
3 |
5 |

3 |
2 |
7 |

4 |
1 |
9 |

5 |
0 |
11 |

The trick here, is to find the pattern. Is there a way we can generalize it? Think about that for a minute. If you look at that table, there's a pattern. Is there a way to say, for any given line, how many spaces and how many stars to display, based on the row number? What do you think?

The number of spaces is the easier of the two. From looking at the table, you can see that we basically start at 5 spaces per line, and end at 0. For any row *n*, the number of spaces that we print will be *5 - n*.

To be honest, you shouldn't need to loop backwards and count down, like I've done in the sample code. I should probably go change that, to make things simpler.

The number of stars to print is a little more challenging. But if you look at it, you can see that we start with 1, and go up by two for each row. For row *n*, we print out *n * 2 + 1* stars.

With all of that in mind, try working through the code one more time. Hopefully, this time it makes more sense.

If you want, here's another interesting challenge to try to print out:

```
********
* *******
** ******
*** *****
**** ****
***** ***
****** **
******* *
*******
```