嵌套过程

# 输出一行 * * * * * *
i = 0
while i<6:
    print("*",end=" ")
    i += 1
    
    
# 输出如下图形:
"""
* * * * * *
* * * * * *
* * * * * *
"""
i = 0
while i<6:
    print("*",end=" ")
    i += 1
print()
    
i = 0
while i<6:
    print("*",end=" ")
    i += 1
print() 

i = 0
while i<6:
    print("*",end=" ")
    i += 1
print() 



# 优化成使用while循环嵌套实现
j = 0
while j<3:
    i = 0
    while i<6:
        print("*",end=" ")
        i += 1
    print() 
    j += 1
    
    
# 输出如下图形:
"""
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
"""
j = 0
while j<6:
    i = 0
    while i<6:
        print("*",end=" ")
        i += 1
    print() 
    j += 1
    
posted @ 2020-11-24 20:59  小杜打醋尢买布  阅读(103)  评论(0编辑  收藏  举报