Commit 07e4dcca by BellCodeEditor

auto save

parent 085b1b00
Showing with 37 additions and 0 deletions
#绘制如下图形,相关参数及要求如下:
#(1)画笔起始位置不限,但是整个图形必须要能够在画布中呈现;
#(2)大的正方形由四个小正方形组成;
#(3)每个小正方形的边长均为 100 像素;
#4)左上角和右下角的正方形填充颜色均为黑色;
#(6)绘制完成后,隐藏画笔
import turtle
p=turtle.Pen()
p.fillcolor("black")
p.begin_fill()
for i in range(4):
p.forward(100)
p.left(90)
p.end_fill()
p.fillcolor("black")
p.begin_fill()
p.forward(100)
for i in range(4):
p.forward(100)
p.right(90)
p.end_fill()
p.right(90)
for i in range(4):
p.forward(100)
p.right(90)
p.right(180)
for i in range(4):
p.forward(100)
p.right(90)
turtle.done()
\ No newline at end of file
print(3.1415926*6**2)
p=float(3.1415926)
r=6
s=p*r**2
print("%0.3f"%s)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment