(
课件网) 福 列表 0 2 CONTENTS 1 指令记忆 problems 问题引入 小海龟是怎么画出不连续的线段的? 海龟先直走;然后抬笔,再直走;落笔,直走,重复几次就可以形成了不连续线段(虚线) 0 2 CONTENTS 2 实 例 演 示 import turtle as t t.goto(0,0) t.speed(0) t.delay(0) t.pendown() anglelist=[30,60,90,120,150,180] colorlist=["red","orange","yellow", "green","blue","purple"] for i in range(180): t.forward(i) t.pencolor(colorlist[i%6]) t.left(anglelist[1]) import turtle turtle.speed(0) turtle.delay(0) # Set up the turtle screen turtle.bgcolor("black") turtle.title("Dynamic Design with 东辰") # Function to draw a dynamic pattern def draw_dynamic_pattern(): colors = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"] for _ in range(72): turtle.pencolor(colors[_ % len(colors)]) turtle.forward(_) turtle.right(45) # Draw the dynamic pattern draw_dynamic_pattern() # Move turtle to a new position to write "东辰" turtle.penup() turtle.goto(-20, -50) turtle.pendown() turtle.color("white") turtle.write("东辰", font=("Arial", 16, "bold")) # Hide the turtle turtle.hideturtle() # Keep the window open turtle.done() 0 2 CONTENTS 4 小 码 当 家 1 取余的认识 样例网址:http://maker./python/ 同 学 们 再 见 !