python画正方形的代码是什么?
python画正方形的代码是:
import turtle #导入 turtle.title("画正方形") turtle.pensize(5) #画笔大小为5 turtle.pencolor("red") #画笔颜色为红 turtle.fillcolor("green") #填充颜色为绿 turtle.begin_fill() #开始填充 for i in range(4): #循环四次 turtle.forward(200) #前进200 turtle.left(90) #左转90度 turtle.end_fill() #结束填充 turtle.done() #导入结束
推荐教程:《python视频教程》
以上就是python画正方形的代码是什么?的详细内容,更多请关注php中文网其它相关文章!
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号