python10 python 打印直角三角形

需要使用嵌套结构

""
举例:打印
*
**
***
****
*****
"""
i = 1
while i <= 5:
    j = 1
    while j <= i:
        print("*", end="")
        j += 1
    print()
    i += 1
# 注意print 打印完后就立马换行
print("*", end="")
# 或者
print("*", end='')

猜你喜欢

转载自blog.csdn.net/qq_35524586/article/details/84931253