在python中使用turtle库给函数图像填色,具体方法如下:
import turtlei = int(input())angle = 360.0 / idistance = 1000.0 / iturtle.begin_fill()turtle.color("yellow")turtle.circle(distance,steps=i)turtle.end_fill()turtle.done()
import turtle
i = int(input())
angle = 360.0 / i
distance = 1000.0 / i
turtle.begin_fill()
turtle.color("yellow")
turtle.circle(distance,steps=i)
turtle.end_fill()
turtle.done()
效果图: