import turtle
import time
def jiange():
turtle.penup()
turtle.fd(10)
def danduan(x):
jiange()
turtle.pendown() if x else turtle.penup()
turtle.fd(80)
jiange()
turtle.right(90)
def huizhi(y):
turtle.speed(100)
danduan(True) if y in ['2', '3', '4', '5', '6', '8',
'9', 'a', 'b', 'd', 'e', 'f'] else danduan(False)
danduan(True) if y in ['0', '1', '3', '4', '5', '6',
'7', '8', '9', 'a', 'b', 'd'] else danduan(False)
danduan(True) if y in ['0', '2', '3', '5', '6', '8',
'9', 'b', 'c', 'd', 'e'] else danduan(False)
danduan(True) if y in ['0', '2', '6', '8', 'a',
'b', 'c', 'd', 'e', 'f'] else danduan(False)
turtle.left(90)
danduan(True) if y in ['0', '4', '5', '6', '8', '9',
'a', 'b', 'c', 'e', 'f'] else danduan(False)
danduan(True) if y in ['0', '2', '3', '5', '6', '7',
'8', '9', 'a', 'c', 'e', 'f'] else danduan(False)
danduan(True) if y in ['0', '1', '2', '3', '4',
'7', '8', '9', 'a', 'd'] else danduan(False)
turtle.penup()
turtle.fd(100)
turtle.left(180)
def shuru(z):
turtle.pencolor("red")
for i in z:
huizhi(i)
turtle.hideturtle()
time.sleep(1)
turtle.clear()
def main():
turtle.setup(500, 350, 200, 200)
turtle.penup()
turtle.fd(-40)
turtle.pensize(10)
shuru("fedcba9876543210")
turtle.done()
main()
![](https://img-blog.csdnimg.cn/20201028110221132.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MTcwMzI1OQ==,size_16,color_FFFFFF,t_70#pic_center)