在python中如何使用循环结构画四个相切的圆
from turtle import *
r=20
x,y=0,0
for i in range(4):
if i==2:
penup()
goto(x,2*r)
penup()
forward(2*r)
pendown()
circle(r)
怎样用Python画圆?
用turtle库,里面就有画圆的函数
python turtle画4个同心圆方法
from turtle import *
def test():
reset()
circle(30,-360)
up()
goto(0,-10)
down()
circle(40,-360)
up()
goto(0,-20)
down()
circle(50,-360)
up()
goto(0,-30)
down()
circle(60,-360)
if __name__ == '__main__':
test()
版权声明:本站所有文章皆为原创,欢迎转载或转发,请保留网站地址和作者信息。