我开始在 trinket.io 上做这个关于绘制雪花的练习,我不太了解循环中的步骤(特别是内循环完成的地方)的顺序。我将非常感谢您的帮助。谢谢! 在此处输入图像描述
#!/bin/python3
import turtle
#starts the software that allows you to draw
import random
# starts the software that provides randomness
orange = turtle.Turtle()
#naming my turtle by associating it with a variable
turtle.Screen().bgcolor("black")
#sets the screen colour to black
colours = ["cyan","purple","white","blue"]
orange.color(random.choice(colours))
#using the random function the program will choose from the list of colours
orange.penup() # moves pen without writing
orange.forward(90) # moves 90 units forward
orange.left(45) #does an angle of 45 anticlockwise (going left)
orange.pendown() #starts drawing
def branch():
for i in range(3):
for i in range(3):
orange.forward(30)
orange.backward(30)
orange.right(45)
orange.left(90)
orange.backward(30)
orange.left(45)
orange.right(90)
orange.forward(90)
for i in range(8):
branch()
orange.left(45)