Challenge 3: Pyramid Printing by Using 'for' Loop

In this challenge, you have to print half a pyramid for a given number of rows.

We'll cover the following

Problem statement

Write code that draws half a pyramid using the # character.

You are given an integer variable rows as input, and you have to print the pyramid with that number of rows displaying #.

Hint: Use for loops to implement the solution.

Example

Input

  • rows is equal to 5.

Then:

Get hands-on with 1400+ tech skills courses.