Exercise 2: Pyramid Printing by Using a For Loop

Print half a pyramid for a given number of rows.

Problem statement

Write the code that prints half a pyramid of the alphabet a. Enter an integer variable rows as input, and print the pyramid with that number of rows displaying a.

Sample input

Create a free account to access the full course.

Continue your learning journey with a 14-day free trial.

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