Hello everyone, welcome back to programminginpython.com! As a part of the series on pattern programming, Here I will explain to you how to print a reverse pyramid pattern or a reverse triangle pattern in Python. In one of my earlier posts, I have explained how to print a pyramid pattern, now I will explain how to print a reverse pyramid pattern in python.
Complete Python Developer Zero to Mastery – Enroll Now.
You can also watch the video on YouTube here.
Python Program to print a Reverse Pyramid Pattern or Reverse Triangle Pattern.
- Read an input integer for asking the range of the triangle using
- Run 3 for loops, one main for row looping, and the other 2 sub-loops for column looping, in the first loop, loop through the range of the triangle for row looping.
- In the second loop, loop through the value of the range from max to 1, this is to print space ` `
- In the third loop, loop through the value of range to max and print
Print Reverse Pyramid Pattern – Code Visualization
The Complete Web Developer Course.
Course: The Complete Web Developer Course 2.0