科创少年.甜老丝.青少年python.青少年Scratch

#for循环、变量、画图
import turtle #引入turtel(海龟)这个库

turtle.setup(300,300,100,0) #设置画布的大小、位置

for x in range(100): #循环(重复执行下面缩进的内容)100次,从0开始,循环到100,X就是一个变量
print(x) #在控制台打印出当前循环的数字
turtle.forward(x) #向前移动x那么多步
turtle.left(90) #左转90°
#循环结束了
turtle.mainloop() #阻塞程序

关注微信公众号:科创少年STEAM创客基地
免费领取更多新课程。
详情请点击 http://kd.cnthc.com/r.html?url=s
http://kd.cnthc.com/r.html?url=p

猜你喜欢

转载自www.cnblogs.com/lsw52053012/p/12531985.html