Home >Backend Development >Python Tutorial >How to print an inverted triangle in python

How to print an inverted triangle in python

尚
Original
2019-06-28 16:45:3413313browse

How to print an inverted triangle in python

Inverted triangle in Python can be implemented using a for loop:

for i in range(6):
    print("")
    for j in range(0,6-i):
         print("*",end=" ")
   print("\n")

How to print an inverted triangle in python

For more Python related technical articles, please visit PythonTutorial column to learn!

The above is the detailed content of How to print an inverted triangle in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn