Python Program for Inverted Star Pattern

Python 3 program to print inverted right angled triangle. Python programming language downward pattern software. In Python, this program will print the pattern downward. In python programs for beginners, this program is used to print the asterisk in reverse, from top to bottom.

lines = 5 
for i in range(lines + 1, 0, -1):
for j in range(0, i - 1):
print("*", end=' ')
print(" ")

Output:

* * * * *

* * * *

* * *

* *

*

range() Method in Python

The range() method in Python creates an immutable series of integers starting with the supplied start integer and ending with the specified finish integer. It’s a built-in function that returns a range object made up of a sequence of integer integers that we may loop over. We can use a range to make creating a for loop easier (). The range() function must have a fixed finish value, but we may vary the start ing value and the step between integers.

For Loop in Python Program

For loops in Python are often used in data science work to loop through an iterable object and perform the same operation on each item. A for loop, for example, would allow us to go over a list and perform the same operation on each item. The for loop in Python is used to iterate over a sequence that might be a list, tuple, array, or string. The init step is the initial one, and it is only performed once. During this stage, you can declare and initialise any loop control variables.