要使用Python繪制小熊,你可以使用Python的圖形庫,如turtle或matplotlib。下面是一個使用turtle庫繪制小熊的示例代碼:
import turtle
# 設置畫布和畫筆
screen = turtle.Screen()
screen.bgcolor('white')
pen = turtle.Turtle()
pen.width(3)
# 繪制小熊的頭部
pen.penup()
pen.goto(0, -100)
pen.pendown()
pen.circle(100)
# 繪制小熊的眼睛
pen.penup()
pen.goto(-40, 40)
pen.pendown()
pen.circle(10)
pen.penup()
pen.goto(40, 40)
pen.pendown()
pen.circle(10)
# 繪制小熊的鼻子
pen.penup()
pen.goto(0, 10)
pen.pendown()
pen.setheading(45)
pen.circle(20, 90)
# 繪制小熊的嘴巴
pen.penup()
pen.goto(-40, -20)
pen.pendown()
pen.setheading(-60)
pen.circle(40, 120)
# 繪制小熊的身體
pen.penup()
pen.goto(-100, -200)
pen.pendown()
pen.setheading(0)
pen.forward(200)
pen.setheading(60)
pen.circle(100, 120)
pen.setheading(180)
pen.forward(200)
pen.setheading(-60)
pen.circle(100, 120)
# 繪制小熊的胳膊
pen.penup()
pen.goto(-100, -200)
pen.pendown()
pen.setheading(-135)
pen.forward(100)
pen.setheading(-45)
pen.forward(100)
pen.penup()
pen.goto(100, -200)
pen.pendown()
pen.setheading(-45)
pen.forward(100)
pen.setheading(45)
pen.forward(100)
# 繪制小熊的腿
pen.penup()
pen.goto(-100, -350)
pen.pendown()
pen.setheading(-45)
pen.forward(100)
pen.setheading(-135)
pen.forward(100)
pen.penup()
pen.goto(100, -350)
pen.pendown()
pen.setheading(-135)
pen.forward(100)
pen.setheading(-45)
pen.forward(100)
turtle.done()
運行上述代碼,就可以在turtle圖形窗口中看到繪制的小熊了。你可以根據需要調整代碼中的參數來調整小熊的大小和位置。