python中使用turtle函數繪圖,具體方法如下:
1.繪制一個五角星
from turtle import * #導入turtle模塊color('red','red')
begin_fill()
for i in range(5):
fd(200)
rt(144)
end_fill()
done()
效果圖:
2.繪制一組內切圓
import turtle #導入turtle模塊
turtle.pensize(2)
turtle.circle(10)
turtle.circle(40)
turtle.circle(80)
turtle.circle(120)
效果圖: