多样三角形

j=5
while j>=1:
    x = 0
    while x <= 5-j :
        print(" ", end="")
        x+= 1
    i = 1
    while i<= 2 * j - 1:
        print("*", end="")
        i += 1
    print()
    j-=1
#结果
 # *********
 #  *******
 #   *****
 #    ***
 #     *

# j=5
# while j>=1:
#     x = 0
#     while x <=10-2*j :
#         print(" ", end="")
#         x+= 1
#     i = 1
#     while i<= 2*j-1:
#         print("*", end="")
#         i += 1
#     print()
#     j-=1
# #运行结果
# """
#  *********
#    *******
#      *****
#        ***
#          *
# """

 

posted @ 2019-01-24 21:53  青春叛逆者  阅读(127)  评论(0编辑  收藏  举报