智一面的面试题提供python的测试题
使用地址:http://www.gtalent.cn/exam/interview?token=52cf92de494f4a8b6165d817a7279966

win环境
import turtle
turtle.speed(11)

L = 60  #  小格子边长
Col = 'black'  #  涂色

def zheng():  # 定义画正方形,并染色
    turtle.down()
    turtle.begin_fill()
    turtle.fillcolor(Col)
    for i in range(4):
        turtle.forward(L)
        turtle.left(90)
    turtle.end_fill()
    turtle.up()

def one():  #  画一排4个正方形并涂色
    for i in range(4):
        zheng()
        turtle.forward(2*L)
    turtle.backward(8*L)
    turtle.right(90)
    turtle.forward(2*L)
    turtle.left(90)

turtle.up()
turtle.goto(-4*L, 4*L)
for i in range(4):
    one()
turtle.goto(-3*L, 3*L)
for i in range(4):
    one()
turtle.up()
turtle.goto(-4*L, 5*L)
turtle.down()
for i in range(4):
    turtle.forward(8*L)
    turtle.right(90)
#  画外圈   
turtle.up()
turtle.goto(-4*L-3, 5*L+3)
turtle.down()
turtle.pensize(2)
for i in range(4):
    turtle.forward(8*L+6)
    turtle.right(90)
#  画最外圈
turtle.up()
turtle.goto(-4*L-3-6, 5*L+3+6)
turtle.down()
turtle.pensize(4)
for i in range(4):
    turtle.forward(8*L+6+12)
    turtle.right(90)
turtle.hideturtle()
turtle.done()

运行结果: