Challenge: Print Pattern using Nested Loops

Can we print the half pyramid pattern using nested loops?

Problem statement

Use nested loops to print the half pyramid pattern in Python and Powershell.

Expected output

Half pyramid pattern of stars:

*
**
***
****
*****

Coding exercise

This problem is designed to check your understanding, so you are encouraged to solve it on your own. If you get completely stuck, refer to the next lesson which will explain the solution in detail.

Python

Get hands-on with 1400+ tech skills courses.