用两种方法(普通方法和循环方法)绘制楼梯

'''
本期用turtle绘制个楼梯,先用最简单的方法绘制,之后在用循环绘制
'''
from turtle import *
pensize(5)
title('绘制楼梯')
color('blue')
forward(40)
left(90)
forward(40)
right(90)
forward(40)


left(90)
forward(40)
right(90)
forward(40)


left(90)
forward(40)
right(90)
forward(40)

from turtle import *
title('用循环绘制楼梯')

color('blue')
pensize(5)

for i in range(6):#几级台阶几个循环
    forward(40)
    left(90)
    forward(40)
    right(90)

 

posted @ 2021-02-28 08:51  有图有派  阅读(547)  评论(0编辑  收藏  举报