Python print cycle using one-delta *

Creative Commons License Copyright: Attribution, allow others to create paper-based, and must distribute paper (based on the original license agreement with the same license Creative Commons )

Python print cycle using one-delta *

Languages other than Python, in order to print a triangle on the screen as shown in at least two cycles
Here Insert Picture Description
using Python, only one is circulated

Program source code

line = 10
for x in range(0, line) :
    print(" " * (line - x),end = " ")
    print("* " * (x + 1))

Test Results

Here Insert Picture Description
The main advantage of the string multiplication Python

Visible Python language can really simplify the amount of code than many other languages

Guess you like

Origin blog.csdn.net/weixin_43876206/article/details/93398216