Exercise 2: Pyramid Printing By Using For Loop

Let's print half a pyramid for a given number of rows.

We'll cover the following

Problem Statement

Write code which prints half a pyramid of the alphabet a.

  • The function takes an integer variable rows as input and prints the pyramid with that number of rows displaying a.

Hint: Use for loops to implement the solution.

Example

Input

  • rows is equal to 5.

Then:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy