What is the method to print a triangle in Python?

In Python, you can use nested loops to print a triangle. Here is an example:

rows = 5

for i in range(rows):
    for j in range(i+1):
        print("*", end="")
    print()

The code above will print a right-angled triangle with five lines, where the number of asterisks increases with each line, the effect is as follows:

*
**
***
****
*****
bannerAds