python编程怎么画正方形(用python怎么画正方形)
http://www.itjxue.com 2023-03-03 18:15 来源:未知 点击次数:
python画正方形的函数
使用turtle实现正方形的绘制,定义形参n为正方形的边长。具体代码如下,望采纳。
python绘制正方形代码
import turtle
for i in range(4)
turtle.forward(100)
turtle.right(90)
turtle.done()
这样就可以了,希望对你有帮助。
如何用python画一个指定大小的正方形
from turtle import *color('red', 'yellow')begin_fill()while True: forward(200) left(170) if abs(pos()) 1: breakend_fill()done()
(责任编辑:IT教学网)
下一篇:没有了