请问下面代码为什么画出来的不是图二

img

img


如何用turtle函数画以下图案?圆的位置居中,每层图形颜色随机生成,还是(100,90)的大小

img

你要用turtle函数画哪个图案?画同心圆要从外往里画
你题目的解答代码如下:

import turtle as t
for i in range(4):
    t.circle(100,180)
    t.left(90)
t.mainloop()

img

import turtle as t
import random

for i in range(200,0,-20):
    color = "#{:0>6x}".format(random.randint(0x0,0xffffff))
    print(color)
    t.fillcolor(color)
    t.pu()
    t.goto(0,-i)
    t.pd()
    t.begin_fill()
    t.circle(i)
    t.end_fill()
t.mainloop()

img

如有帮助,请点击我的回答下方的【采纳该答案】按钮帮忙采纳下,谢谢!

img

语句 t.circle(100.90)写错了,应该是t.circle(100,90)中间是逗号,改一下就行了。图三代码:

import turtle as t
import random 

c=['red','blue','green','cyan','yellow']
for i in range(9,-1,-1):
    t.pu()
    t.goto(0,-10*(i+1))
    t.pd()
    t.begin_fill()
    t.circle(10*(i+1))
    t.fillcolor(random.choice(c))
    t.end_fill()
t.hideturtle()    
t.mainloop()

如有帮助,请点采纳。

您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!
PS:问答VIP年卡 【限时加赠:IT技术图书免费领】,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632